OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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("../../../pkg/dartdoc/mirrors/mirrors.dart"); | 5 #import("../../../pkg/dartdoc/mirrors/mirrors.dart"); |
6 #import("../../../pkg/dartdoc/mirrors/mirrors_util.dart"); | 6 #import("../../../pkg/dartdoc/mirrors/mirrors_util.dart"); |
7 | 7 |
8 #import('dart:io'); | 8 #import('dart:io'); |
9 | 9 |
10 int count(Iterable iterable) { | 10 int count(Iterable iterable) { |
(...skipping 11 matching lines...) Expand all Loading... | |
22 } | 22 } |
23 } | 23 } |
24 return false; | 24 return false; |
25 } | 25 } |
26 | 26 |
27 main() { | 27 main() { |
28 var scriptPath = new Path.fromNative(new Options().script); | 28 var scriptPath = new Path.fromNative(new Options().script); |
29 var dirPath = scriptPath.directoryPath; | 29 var dirPath = scriptPath.directoryPath; |
30 var libPath = dirPath.join(new Path.fromNative('../../../')); | 30 var libPath = dirPath.join(new Path.fromNative('../../../')); |
31 var inputPath = dirPath.join(new Path.fromNative('mirrors_helper.dart')); | 31 var inputPath = dirPath.join(new Path.fromNative('mirrors_helper.dart')); |
32 var compilation = new Compilation(inputPath, libPath); | 32 var compilation = new Compilation.library([inputPath], libPath); |
Johnni Winther
2012/08/17 13:54:27
This will make the path used by dartdoc tested wit
ahe
2012/08/21 08:50:28
I was surprised that you didn't land this change b
| |
33 Expect.isNotNull(compilation, "No compilation created"); | 33 Expect.isNotNull(compilation, "No compilation created"); |
34 | 34 |
35 var mirrors = compilation.mirrors; | 35 var mirrors = compilation.mirrors; |
36 Expect.isNotNull(mirrors, "No mirror system returned from compilation"); | 36 Expect.isNotNull(mirrors, "No mirror system returned from compilation"); |
37 | 37 |
38 var libraries = mirrors.libraries; | 38 var libraries = mirrors.libraries; |
39 Expect.isNotNull(libraries, "No libraries map returned"); | 39 Expect.isNotNull(libraries, "No libraries map returned"); |
40 Expect.isFalse(libraries.isEmpty(), "Empty libraries map returned"); | 40 Expect.isFalse(libraries.isEmpty(), "Empty libraries map returned"); |
41 | 41 |
42 var helperLibrary = findMirror(libraries, "mirrors_helper"); | 42 var helperLibrary = findMirror(libraries, "mirrors_helper"); |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 Expect.isFalse(funcTypedef.isClass, "Typedef is class"); | 546 Expect.isFalse(funcTypedef.isClass, "Typedef is class"); |
547 Expect.isFalse(funcTypedef.isInterface, "Typedef is interface"); | 547 Expect.isFalse(funcTypedef.isInterface, "Typedef is interface"); |
548 Expect.isFalse(funcTypedef.isPrivate, "Typedef is private"); | 548 Expect.isFalse(funcTypedef.isPrivate, "Typedef is private"); |
549 Expect.isNull(funcTypedef.defaultType, | 549 Expect.isNull(funcTypedef.defaultType, |
550 "Typedef default type is non-null"); | 550 "Typedef default type is non-null"); |
551 // TODO(johnniwinther): Should not throw an exception since the type should | 551 // TODO(johnniwinther): Should not throw an exception since the type should |
552 // not be the declaration. | 552 // not be the declaration. |
553 Expect.throws(() => funcTypedef.typeArguments, | 553 Expect.throws(() => funcTypedef.typeArguments, |
554 (exception) => true, | 554 (exception) => true, |
555 "Typedef has type arguments"); | 555 "Typedef has type arguments"); |
556 Expect.isNotNull(funcTypedef.typeVariables, "Type variables is null"); | 556 var funcTypedefTypeVariables = funcTypedef.typeVariables; |
557 // TODO(johnniwinther): Should return a non-empty map. | 557 Expect.isNotNull(funcTypedefTypeVariables, "Type variables is null"); |
ahe
2012/08/21 08:50:28
The String argument to isNotNull is virtually poin
Johnni Winther
2012/08/21 09:30:27
Done.
| |
558 Expect.isTrue(funcTypedef.typeVariables.isEmpty(), | 558 Expect.equals(2, funcTypedefTypeVariables.length, |
559 "Type variables is non-empty"); | 559 "Unexpected type variable count"); |
ahe
2012/08/21 08:50:28
Ditto.
Johnni Winther
2012/08/21 09:30:27
Done.
| |
560 // TODO(johnniwinther): Provide access to the definition type. | 560 |
561 Expect.isNull(funcTypedef.definition, "Typedef definition is not null"); | 561 var funcTypedefDefinition = funcTypedef.definition; |
562 Expect.isNotNull(funcTypedefDefinition, "Typedef definition is null"); | |
ahe
2012/08/21 08:50:28
Ditto.
Johnni Winther
2012/08/21 09:30:27
Done.
| |
563 Expect.isTrue(funcTypedefDefinition is FunctionTypeMirror, | |
564 "Unexpected typedef definition"); | |
ahe
2012/08/21 08:50:28
Ditto.
Johnni Winther
2012/08/21 09:30:27
Done.
| |
562 | 565 |
563 Expect.stringEquals("func2", method3Parameter2.simpleName, | 566 Expect.stringEquals("func2", method3Parameter2.simpleName, |
564 "Unexpected parameter simpleName"); | 567 "Unexpected parameter simpleName"); |
565 Expect.stringEquals("mirrors_helper.Baz.method3#func2", | 568 Expect.stringEquals("mirrors_helper.Baz.method3#func2", |
566 method3Parameter2.qualifiedName, | 569 method3Parameter2.qualifiedName, |
567 "Unexpected parameter qualifiedName"); | 570 "Unexpected parameter qualifiedName"); |
568 Expect.isFalse(method3Parameter2.hasDefaultValue, | 571 Expect.isFalse(method3Parameter2.hasDefaultValue, |
569 "Parameter 'func2' has default value: " | 572 "Parameter 'func2' has default value: " |
570 "${method3Parameter2.defaultValue}"); | 573 "${method3Parameter2.defaultValue}"); |
571 Expect.isNull(method3Parameter2.defaultValue, | 574 Expect.isNull(method3Parameter2.defaultValue, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 Expect.stringEquals('negate', operator_negate.operatorName, | 635 Expect.stringEquals('negate', operator_negate.operatorName, |
633 "Unexpected operatorName"); | 636 "Unexpected operatorName"); |
634 | 637 |
635 | 638 |
636 var bazClassConstructors = bazClass.constructors; | 639 var bazClassConstructors = bazClass.constructors; |
637 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); | 640 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); |
638 Expect.equals(3, bazClassConstructors.length, | 641 Expect.equals(3, bazClassConstructors.length, |
639 "Unexpected number of constructors"); | 642 "Unexpected number of constructors"); |
640 // TODO(johnniwinther): Add tests of constructors. | 643 // TODO(johnniwinther): Add tests of constructors. |
641 } | 644 } |
OLD | NEW |