Skip to content

Commit 067ebcb

Browse files
committed
Clean up of library names, mirror usage, deprecated pkg/test usage of Throws
1 parent b39d157 commit 067ebcb

File tree

6 files changed

+9
-16
lines changed

6 files changed

+9
-16
lines changed

lib/src/annotation.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ bool matchAnnotation(Type annotationType, ElementAnnotation annotation) {
222222
throw new ArgumentError.value(annotation, 'annotation',
223223
'Could not determine type of annotation. Are you missing a dependency?');
224224
}
225-
225+
226226
return matchTypes(annotationType, annotationValueType);
227227
}
228228

test/json_serializable_integration_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library source_gen.test.json_serializable_integration_test;
6-
75
import 'dart:convert';
86

97
import 'package:test/test.dart';

test/src/comment_generator.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
library source_gen.test.comment_generator;
2-
31
import 'dart:async';
42

53
import 'package:analyzer/dart/element/element.dart';

test/src/io.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4-
library source_gen.test.src.io;
54

65
import 'dart:async';
76
import 'dart:io';

test/test_all.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library source_gen.test.test_all;
6-
75
import 'annotation_test.dart' as annotation;
86
import 'builder_test.dart' as builder;
97
import 'find_libraries_test.dart' as find_libraries;

test/test_utils.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
library source_gen.test.utils;
6-
75
import 'dart:mirrors';
86

97
import 'package:path/path.dart' as p;
@@ -13,19 +11,21 @@ import 'package:test/test.dart';
1311
String _packagePathCache;
1412

1513
String getPackagePath() {
16-
// TODO(kevmoo) - ideally we'd have a more clean way to do this
17-
// See https://github.com/dart-lang/sdk/issues/23990
1814
if (_packagePathCache == null) {
19-
var currentFilePath =
20-
currentMirrorSystem().findLibrary(#source_gen.test.utils).uri.path;
15+
// Getting the location of this file – via reflection
16+
var currentFilePath = (reflect(getPackagePath) as ClosureMirror)
17+
.function
18+
.location
19+
.sourceUri
20+
.path;
2121

2222
_packagePathCache = p.normalize(p.join(p.dirname(currentFilePath), '..'));
2323
}
2424
return _packagePathCache;
2525
}
2626

27-
const Matcher throwsInvalidGenerationSourceError =
28-
const Throws(isInvalidGenerationSourceError);
27+
final Matcher throwsInvalidGenerationSourceError =
28+
throwsA(isInvalidGenerationSourceError);
2929

3030
const Matcher isInvalidGenerationSourceError =
3131
const _InvalidGenerationSourceError();

0 commit comments

Comments
 (0)