| 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 import 'package:test/test.dart'; | 5 import 'package:test/test.dart'; |
| 6 import 'package:test/src/backend/platform_selector/ast.dart'; | 6 import 'package:test/src/backend/platform_selector/ast.dart'; |
| 7 import 'package:test/src/backend/platform_selector/parser.dart'; | 7 import 'package:test/src/backend/platform_selector/parser.dart'; |
| 8 | 8 |
| 9 /// A matcher that asserts that a value is a [ConditionalNode]. | 9 /// A matcher that asserts that a value is a [ConditionalNode]. |
| 10 Matcher _isConditionalNode = | 10 Matcher _isConditionalNode = new isInstanceOf<ConditionalNode>(); |
| 11 new isInstanceOf<ConditionalNode>("ConditionalNode"); | |
| 12 | 11 |
| 13 /// A matcher that asserts that a value is an [OrNode]. | 12 /// A matcher that asserts that a value is an [OrNode]. |
| 14 Matcher _isOrNode = new isInstanceOf<OrNode>("OrNode"); | 13 Matcher _isOrNode = new isInstanceOf<OrNode>(); |
| 15 | 14 |
| 16 /// A matcher that asserts that a value is an [AndNode]. | 15 /// A matcher that asserts that a value is an [AndNode]. |
| 17 Matcher _isAndNode = new isInstanceOf<AndNode>("AndNode"); | 16 Matcher _isAndNode = new isInstanceOf<AndNode>(); |
| 18 | 17 |
| 19 /// A matcher that asserts that a value is a [NotNode]. | 18 /// A matcher that asserts that a value is a [NotNode]. |
| 20 Matcher _isNotNode = new isInstanceOf<NotNode>("NotNode"); | 19 Matcher _isNotNode = new isInstanceOf<NotNode>(); |
| 21 | 20 |
| 22 void main() { | 21 void main() { |
| 23 group("parses a conditional expression", () { | 22 group("parses a conditional expression", () { |
| 24 test("with identifiers", () { | 23 test("with identifiers", () { |
| 25 var node = _parse(" a ? b : c "); | 24 var node = _parse(" a ? b : c "); |
| 26 expect(node.toString(), equals("a ? b : c")); | 25 expect(node.toString(), equals("a ? b : c")); |
| 27 | 26 |
| 28 expect(node.span.text, equals("a ? b : c")); | 27 expect(node.span.text, equals("a ? b : c")); |
| 29 expect(node.span.start.offset, equals(2)); | 28 expect(node.span.start.offset, equals(2)); |
| 30 expect(node.span.end.offset, equals(11)); | 29 expect(node.span.end.offset, equals(11)); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 (value) => value is VariableNode && value.name == name, | 257 (value) => value is VariableNode && value.name == name, |
| 259 'is a variable named "$name"'); | 258 'is a variable named "$name"'); |
| 260 | 259 |
| 261 void _expectToString(String selector, [String result]) { | 260 void _expectToString(String selector, [String result]) { |
| 262 if (result == null) result = selector; | 261 if (result == null) result = selector; |
| 263 expect(_toString(selector), equals(result), | 262 expect(_toString(selector), equals(result), |
| 264 reason: 'Expected toString of "$selector" to be "$result".'); | 263 reason: 'Expected toString of "$selector" to be "$result".'); |
| 265 } | 264 } |
| 266 | 265 |
| 267 String _toString(String selector) => new Parser(selector).parse().toString(); | 266 String _toString(String selector) => new Parser(selector).parse().toString(); |
| OLD | NEW |