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

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: 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
100 print([args[1], args[1].runtimeType]);
Bob Nystrom 2015/03/17 19:55:25 Delete this.
kevmoo 2015/03/17 19:57:00 Done.
101
102 expect(args[1], new isInstanceOf<NamedExpression>());
100 expect(args[1].expression, new isInstanceOf<IntegerLiteral>()); 103 expect(args[1].expression, new isInstanceOf<IntegerLiteral>());
101 expect(args[1].expression.value, equals(12)); 104 expect(args[1].expression.value, equals(12));
102 }); 105 });
103 106
104 test("with a prefix/named constructor", () { 107 test("with a prefix/named constructor", () {
105 new File(_path).writeAsStringSync("@Annotation.name()\nlibrary foo;"); 108 new File(_path).writeAsStringSync("@Annotation.name()\nlibrary foo;");
106 109
107 var annotations = parseAnnotations(_path); 110 var annotations = parseAnnotations(_path);
108 expect(annotations, hasLength(1)); 111 expect(annotations, hasLength(1));
109 expect(annotations.first.name, new isInstanceOf<PrefixedIdentifier>()); 112 expect(annotations.first.name, new isInstanceOf<PrefixedIdentifier>());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 173
171 var annotations = parseAnnotations(_path); 174 var annotations = parseAnnotations(_path);
172 expect(annotations, hasLength(2)); 175 expect(annotations, hasLength(2));
173 expect(annotations[0].name.name, equals('Annotation1')); 176 expect(annotations[0].name.name, equals('Annotation1'));
174 expect(annotations[0].arguments.arguments, isEmpty); 177 expect(annotations[0].arguments.arguments, isEmpty);
175 expect(annotations[1].name.name, equals('Annotation2')); 178 expect(annotations[1].name.name, equals('Annotation2'));
176 expect(annotations[1].arguments.arguments, isEmpty); 179 expect(annotations[1].arguments.arguments, isEmpty);
177 }); 180 });
178 }); 181 });
179 } 182 }
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