| 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("../../../lib/dartdoc/mirrors/mirrors.dart"); | 5 #import("../../../lib/dartdoc/mirrors/mirrors.dart"); |
| 6 #import("../../../lib/dartdoc/mirrors/mirrors_util.dart"); | 6 #import("../../../lib/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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 "Parameter default value is non-null"); | 434 "Parameter default value is non-null"); |
| 435 Expect.isFalse(method2Parameter1.isOptional(), "Parameter is optional"); | 435 Expect.isFalse(method2Parameter1.isOptional(), "Parameter is optional"); |
| 436 var method2Parameter2 = method2Parameters[1]; | 436 var method2Parameter2 = method2Parameters[1]; |
| 437 Expect.isNotNull(method2Parameter2, "Parameter is null"); | 437 Expect.isNotNull(method2Parameter2, "Parameter is null"); |
| 438 Expect.equals(bazF, method2Parameter2.type()); | 438 Expect.equals(bazF, method2Parameter2.type()); |
| 439 Expect.stringEquals("f", method2Parameter2.simpleName(), | 439 Expect.stringEquals("f", method2Parameter2.simpleName(), |
| 440 "Unexpected parameter simpleName"); | 440 "Unexpected parameter simpleName"); |
| 441 Expect.stringEquals("mirrors_helper.Baz.method2#f", | 441 Expect.stringEquals("mirrors_helper.Baz.method2#f", |
| 442 method2Parameter2.qualifiedName(), | 442 method2Parameter2.qualifiedName(), |
| 443 "Unexpected parameter qualifiedName"); | 443 "Unexpected parameter qualifiedName"); |
| 444 // TODO(johnniwinther): Should return true: | 444 Expect.isTrue(method2Parameter2.hasDefaultValue(), |
| 445 Expect.isFalse(method2Parameter2.hasDefaultValue(), | |
| 446 "Parameter has default value"); | 445 "Parameter has default value"); |
| 447 // TODO(johnniwinther): Should return a non-null value: | 446 Expect.stringEquals("null", method2Parameter2.defaultValue(), |
| 448 Expect.isNull(method2Parameter2.defaultValue(), | 447 "Parameter default value is non-null"); |
| 449 "Parameter default value is non-null"); | |
| 450 Expect.isTrue(method2Parameter2.isOptional(), "Parameter is not optional"); | 448 Expect.isTrue(method2Parameter2.isOptional(), "Parameter is not optional"); |
| 451 | 449 |
| 452 //////////////////////////////////////////////////////////////////////////// | 450 //////////////////////////////////////////////////////////////////////////// |
| 453 // void method3(E func1(F f), Func<E,F> func2) {} | 451 // void method3(E func1(F f), Func<E,F> func2) {} |
| 454 //////////////////////////////////////////////////////////////////////////// | 452 //////////////////////////////////////////////////////////////////////////// |
| 455 var method3 = findMirror(bazClassMembers, "method3"); | 453 var method3 = findMirror(bazClassMembers, "method3"); |
| 456 Expect.isNotNull(method3, "method3 not found"); | 454 Expect.isNotNull(method3, "method3 not found"); |
| 457 Expect.stringEquals('method3', method3.simpleName(), | 455 Expect.stringEquals('method3', method3.simpleName(), |
| 458 "Unexpected method simpleName"); | 456 "Unexpected method simpleName"); |
| 459 Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName(), | 457 Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName(), |
| (...skipping 17 matching lines...) Expand all Loading... |
| 477 Expect.isNull(method3.operatorName, | 475 Expect.isNull(method3.operatorName, |
| 478 "Method operatorName is non-null"); | 476 "Method operatorName is non-null"); |
| 479 | 477 |
| 480 Expect.equals(voidType, method3.returnType(), "Return type is not void"); | 478 Expect.equals(voidType, method3.returnType(), "Return type is not void"); |
| 481 | 479 |
| 482 var method3Parameters = method3.parameters(); | 480 var method3Parameters = method3.parameters(); |
| 483 Expect.isNotNull(method3Parameters, "Method parameters is null"); | 481 Expect.isNotNull(method3Parameters, "Method parameters is null"); |
| 484 Expect.equals(2, method3Parameters.length, "Unexpected parameter count"); | 482 Expect.equals(2, method3Parameters.length, "Unexpected parameter count"); |
| 485 var method3Parameter1 = method3Parameters[0]; | 483 var method3Parameter1 = method3Parameters[0]; |
| 486 Expect.isNotNull(method3Parameter1, "Parameter is null"); | 484 Expect.isNotNull(method3Parameter1, "Parameter is null"); |
| 487 // TODO(johnniwinther): Should return the function type E func(F f): | 485 var method3Parameter1type = method3Parameter1.type(); |
| 488 Expect.equals(dynamicType, method3Parameter1.type()); | 486 Expect.isNotNull(method3Parameter1type, "Parameter type of 'func1' is null"); |
| 487 Expect.isTrue(method3Parameter1type is FunctionTypeMirror, |
| 488 "Parameter type of 'func1' is not a function"); |
| 489 Expect.equals(bazE, method3Parameter1type.returnType(), |
| 490 "Return type of 'func1' is not a E"); |
| 491 Expect.isNotNull(method3Parameter1type.parameters(), |
| 492 "Parameters of 'func1' is null"); |
| 493 Expect.equals(1, method3Parameter1type.parameters().length, |
| 494 "Unexpected parameter count of 'func1'"); |
| 495 Expect.equals(bazE, method3Parameter1type.returnType(), |
| 496 "Return type of 'func1' is not a E"); |
| 497 Expect.isNotNull(method3Parameter1type.parameters()[0], |
| 498 "Parameter 1 of 'func1' is null"); |
| 499 Expect.stringEquals('f', method3Parameter1type.parameters()[0].simpleName(), |
| 500 "Unexpected name parameter 1 of 'func1'"); |
| 501 Expect.equals(bazF, method3Parameter1type.parameters()[0].type(), |
| 502 "Argument type of 'func1' is not a F"); |
| 489 Expect.stringEquals("func1", method3Parameter1.simpleName(), | 503 Expect.stringEquals("func1", method3Parameter1.simpleName(), |
| 490 "Unexpected parameter simpleName"); | 504 "Unexpected parameter simpleName"); |
| 491 Expect.stringEquals("mirrors_helper.Baz.method3#func1", | 505 Expect.stringEquals("mirrors_helper.Baz.method3#func1", |
| 492 method3Parameter1.qualifiedName(), | 506 method3Parameter1.qualifiedName(), |
| 493 "Unexpected parameter qualifiedName"); | 507 "Unexpected parameter qualifiedName"); |
| 494 Expect.isFalse(method3Parameter1.hasDefaultValue(), | 508 Expect.isFalse(method3Parameter1.hasDefaultValue(), |
| 495 "Parameter has default value"); | 509 "Parameter has default value"); |
| 496 Expect.isNull(method3Parameter1.defaultValue(), | 510 Expect.isNull(method3Parameter1.defaultValue(), |
| 497 "Parameter default value is non-null"); | 511 "Parameter default value is non-null"); |
| 498 Expect.isFalse(method3Parameter1.isOptional(), "Parameter is optional"); | 512 Expect.isFalse(method3Parameter1.isOptional(), "Parameter is optional"); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 "Type variables is non-empty"); | 556 "Type variables is non-empty"); |
| 543 // TODO(johnniwinther): Provide access to the definition type. | 557 // TODO(johnniwinther): Provide access to the definition type. |
| 544 Expect.isNull(funcTypedef.definition(), "Typedef definition is not null"); | 558 Expect.isNull(funcTypedef.definition(), "Typedef definition is not null"); |
| 545 | 559 |
| 546 Expect.stringEquals("func2", method3Parameter2.simpleName(), | 560 Expect.stringEquals("func2", method3Parameter2.simpleName(), |
| 547 "Unexpected parameter simpleName"); | 561 "Unexpected parameter simpleName"); |
| 548 Expect.stringEquals("mirrors_helper.Baz.method3#func2", | 562 Expect.stringEquals("mirrors_helper.Baz.method3#func2", |
| 549 method3Parameter2.qualifiedName(), | 563 method3Parameter2.qualifiedName(), |
| 550 "Unexpected parameter qualifiedName"); | 564 "Unexpected parameter qualifiedName"); |
| 551 Expect.isFalse(method3Parameter2.hasDefaultValue(), | 565 Expect.isFalse(method3Parameter2.hasDefaultValue(), |
| 552 "Parameter has default value"); | 566 "Parameter 'func2' has default value: " |
| 567 "${method3Parameter2.defaultValue()}"); |
| 553 Expect.isNull(method3Parameter2.defaultValue(), | 568 Expect.isNull(method3Parameter2.defaultValue(), |
| 554 "Parameter default value is non-null"); | 569 "Parameter default value is non-null"); |
| 555 Expect.isFalse(method3Parameter2.isOptional(), "Parameter is optional"); | 570 Expect.isFalse(method3Parameter2.isOptional(), "Parameter is optional"); |
| 556 | 571 |
| 557 //////////////////////////////////////////////////////////////////////////// | 572 //////////////////////////////////////////////////////////////////////////// |
| 558 // bool operator==(Object other) => return false; | 573 // bool operator==(Object other) => return false; |
| 559 //////////////////////////////////////////////////////////////////////////// | 574 //////////////////////////////////////////////////////////////////////////// |
| 560 var operator_eq = findMirror(bazClassMembers, "operator", operatorName: '=='); | 575 var operator_eq = findMirror(bazClassMembers, "operator", operatorName: '=='); |
| 561 Expect.isNotNull(operator_eq, "operator == not found"); | 576 Expect.isNotNull(operator_eq, "operator == not found"); |
| 562 Expect.stringEquals('operator', operator_eq.simpleName(), | 577 Expect.stringEquals('operator', operator_eq.simpleName(), |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 Expect.stringEquals('negate', operator_negate.operatorName, | 629 Expect.stringEquals('negate', operator_negate.operatorName, |
| 615 "Unexpected operatorName"); | 630 "Unexpected operatorName"); |
| 616 | 631 |
| 617 | 632 |
| 618 var bazClassConstructors = bazClass.constructors(); | 633 var bazClassConstructors = bazClass.constructors(); |
| 619 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); | 634 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); |
| 620 Expect.equals(3, bazClassConstructors.length, | 635 Expect.equals(3, bazClassConstructors.length, |
| 621 "Unexpected number of constructors"); | 636 "Unexpected number of constructors"); |
| 622 // TODO(johnniwinther): Add tests of constructors. | 637 // TODO(johnniwinther): Add tests of constructors. |
| 623 } | 638 } |
| OLD | NEW |