OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
7 | 7 |
8 library analysis_server.test.server_options; | 8 library analysis_server.test.server_options; |
9 | 9 |
10 import 'package:analysis_server/src/server_options.dart'; | 10 import 'package:analysis_server/src/server_options.dart'; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:test/test.dart'; |
12 | 12 |
13 import 'utils.dart'; | 13 import 'utils.dart'; |
14 | 14 |
15 void main() { | 15 void main() { |
16 initializeTestEnvironment(); | 16 initializeTestEnvironment(); |
17 | 17 |
18 group('server_options', () { | 18 group('server_options', () { |
19 test('basic - []', () { | 19 test('basic - []', () { |
20 var options = new ServerOptions.fromContents('''# ignored | 20 var options = new ServerOptions.fromContents('''# ignored |
21 foo: bar | 21 foo: bar |
22 baz: padded | 22 baz: padded |
Paul Berry
2016/10/06 15:55:45
Don't delete the end of line space here. It's nec
scheglov
2016/10/06 17:17:07
OK
I changed the code to make it resilient to for
| |
23 '''); | 23 '''); |
24 expect(options['foo'], equals('bar')); | 24 expect(options['foo'], equals('bar')); |
25 expect(options['baz'], equals('padded')); | 25 expect(options['baz'], equals('padded')); |
26 }); | 26 }); |
27 test('basic - isSet', () { | 27 test('basic - isSet', () { |
28 var options = new ServerOptions.fromContents('''foo: true | 28 var options = new ServerOptions.fromContents('''foo: true |
29 bar: TRUE | 29 bar: TRUE |
30 baz: false | 30 baz: false |
31 foobar: off | 31 foobar: off |
32 '''); | 32 '''); |
33 expect(options.isSet('foo'), isTrue); | 33 expect(options.isSet('foo'), isTrue); |
34 expect(options.isSet('bar'), isTrue); | 34 expect(options.isSet('bar'), isTrue); |
35 expect(options.isSet('baz'), isFalse); | 35 expect(options.isSet('baz'), isFalse); |
36 expect(options.isSet('foobar'), isFalse); | 36 expect(options.isSet('foobar'), isFalse); |
37 expect(options.isSet('does_not_exist'), isFalse); | 37 expect(options.isSet('does_not_exist'), isFalse); |
38 expect(options.isSet('does_not_exist', defaultValue: true), isTrue); | 38 expect(options.isSet('does_not_exist', defaultValue: true), isTrue); |
39 }); | 39 }); |
40 | 40 |
41 test('basic - getStringValue', () { | 41 test('basic - getStringValue', () { |
42 var options = new ServerOptions.fromContents('''foo: someValue | 42 var options = new ServerOptions.fromContents('''foo: someValue |
43 '''); | 43 '''); |
44 expect(options.getStringValue('foo'), equals('someValue')); | 44 expect(options.getStringValue('foo'), equals('someValue')); |
45 expect(options.getStringValue('not_there'), isNull); | 45 expect(options.getStringValue('not_there'), isNull); |
46 expect(options.getStringValue('not_there', defaultValue: 'bar'), | 46 expect(options.getStringValue('not_there', defaultValue: 'bar'), |
47 equals('bar')); | 47 equals('bar')); |
48 }); | 48 }); |
49 }); | 49 }); |
50 } | 50 } |
OLD | NEW |