Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: test/util/parse_annotations_test.dart

Issue 1017813002: pkg/unittest: fix a broken test and update status files (Closed) Base URL: https://github.com/dart-lang/unittest.git@master
Patch Set: cl nit Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « .status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:path/path.dart' as p; 8 import 'package:path/path.dart' as p;
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'package:unittest/src/util/dart.dart'; 10 import 'package:unittest/src/util/dart.dart';
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 "@Annotation(name1: 'foo', name2: 12)\nlibrary foo;"); 89 "@Annotation(name1: 'foo', name2: 12)\nlibrary foo;");
90 90
91 var annotations = parseAnnotations(_path); 91 var annotations = parseAnnotations(_path);
92 expect(annotations, hasLength(1)); 92 expect(annotations, hasLength(1));
93 expect(annotations.first.name.name, equals('Annotation')); 93 expect(annotations.first.name.name, equals('Annotation'));
94 var args = annotations.first.arguments.arguments; 94 var args = annotations.first.arguments.arguments;
95 expect(args, hasLength(2)); 95 expect(args, hasLength(2));
96 expect(args[0], new isInstanceOf<NamedExpression>()); 96 expect(args[0], new isInstanceOf<NamedExpression>());
97 expect(args[0].expression, new isInstanceOf<StringLiteral>()); 97 expect(args[0].expression, new isInstanceOf<StringLiteral>());
98 expect(args[0].expression.stringValue, equals('foo')); 98 expect(args[0].expression.stringValue, equals('foo'));
99 expect(args[1], new isInstanceOf<IntegerLiteral>()); 99 expect(args[1], new isInstanceOf<NamedExpression>());
100 expect(args[1].expression, new isInstanceOf<IntegerLiteral>()); 100 expect(args[1].expression, new isInstanceOf<IntegerLiteral>());
101 expect(args[1].expression.value, equals(12)); 101 expect(args[1].expression.value, equals(12));
102 }); 102 });
103 103
104 test("with a prefix/named constructor", () { 104 test("with a prefix/named constructor", () {
105 new File(_path).writeAsStringSync("@Annotation.name()\nlibrary foo;"); 105 new File(_path).writeAsStringSync("@Annotation.name()\nlibrary foo;");
106 106
107 var annotations = parseAnnotations(_path); 107 var annotations = parseAnnotations(_path);
108 expect(annotations, hasLength(1)); 108 expect(annotations, hasLength(1));
109 expect(annotations.first.name, new isInstanceOf<PrefixedIdentifier>()); 109 expect(annotations.first.name, new isInstanceOf<PrefixedIdentifier>());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 var annotations = parseAnnotations(_path); 171 var annotations = parseAnnotations(_path);
172 expect(annotations, hasLength(2)); 172 expect(annotations, hasLength(2));
173 expect(annotations[0].name.name, equals('Annotation1')); 173 expect(annotations[0].name.name, equals('Annotation1'));
174 expect(annotations[0].arguments.arguments, isEmpty); 174 expect(annotations[0].arguments.arguments, isEmpty);
175 expect(annotations[1].name.name, equals('Annotation2')); 175 expect(annotations[1].name.name, equals('Annotation2'));
176 expect(annotations[1].arguments.arguments, isEmpty); 176 expect(annotations[1].arguments.arguments, isEmpty);
177 }); 177 });
178 }); 178 });
179 } 179 }
OLDNEW
« no previous file with comments | « .status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698