| 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 18 matching lines...) Expand all Loading... |
| 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 // TODO(johnniwinther): Should return the function type E func(F f): |
| 488 Expect.equals(dynamicType, method3Parameter1.type()); | 486 var method3Parameter1type = method3Parameter1.type(); |
| 487 Expect.isNotNull(method3Parameter1type, "Parameter type of 'func1' is null"); |
| 488 Expect.isTrue(method3Parameter1type is FunctionTypeMirror, |
| 489 "Parameter type of 'func1' is not a function"); |
| 490 Expect.equals(bazE, method3Parameter1type.returnType(), |
| 491 "Return type of 'func1' is not a E"); |
| 492 Expect.isNotNull(method3Parameter1type.parameters(), |
| 493 "Parameters of 'func1' is null"); |
| 494 Expect.equals(1, method3Parameter1type.parameters().length, |
| 495 "Unexpected parameter count of 'func1'"); |
| 496 Expect.equals(bazE, method3Parameter1type.returnType(), |
| 497 "Return type of 'func1' is not a E"); |
| 498 Expect.isNotNull(method3Parameter1type.parameters()[0], |
| 499 "Parameter 1 of 'func1' is null"); |
| 500 Expect.stringEquals('f', method3Parameter1type.parameters()[0].simpleName(), |
| 501 "Unexpected name parameter 1 of 'func1'"); |
| 502 Expect.equals(bazF, method3Parameter1type.parameters()[0].type(), |
| 503 "Return type of 'func1' is not a F"); |
| 489 Expect.stringEquals("func1", method3Parameter1.simpleName(), | 504 Expect.stringEquals("func1", method3Parameter1.simpleName(), |
| 490 "Unexpected parameter simpleName"); | 505 "Unexpected parameter simpleName"); |
| 491 Expect.stringEquals("mirrors_helper.Baz.method3#func1", | 506 Expect.stringEquals("mirrors_helper.Baz.method3#func1", |
| 492 method3Parameter1.qualifiedName(), | 507 method3Parameter1.qualifiedName(), |
| 493 "Unexpected parameter qualifiedName"); | 508 "Unexpected parameter qualifiedName"); |
| 494 Expect.isFalse(method3Parameter1.hasDefaultValue(), | 509 Expect.isFalse(method3Parameter1.hasDefaultValue(), |
| 495 "Parameter has default value"); | 510 "Parameter has default value"); |
| 496 Expect.isNull(method3Parameter1.defaultValue(), | 511 Expect.isNull(method3Parameter1.defaultValue(), |
| 497 "Parameter default value is non-null"); | 512 "Parameter default value is non-null"); |
| 498 Expect.isFalse(method3Parameter1.isOptional(), "Parameter is optional"); | 513 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"); | 557 "Type variables is non-empty"); |
| 543 // TODO(johnniwinther): Provide access to the definition type. | 558 // TODO(johnniwinther): Provide access to the definition type. |
| 544 Expect.isNull(funcTypedef.definition(), "Typedef definition is not null"); | 559 Expect.isNull(funcTypedef.definition(), "Typedef definition is not null"); |
| 545 | 560 |
| 546 Expect.stringEquals("func2", method3Parameter2.simpleName(), | 561 Expect.stringEquals("func2", method3Parameter2.simpleName(), |
| 547 "Unexpected parameter simpleName"); | 562 "Unexpected parameter simpleName"); |
| 548 Expect.stringEquals("mirrors_helper.Baz.method3#func2", | 563 Expect.stringEquals("mirrors_helper.Baz.method3#func2", |
| 549 method3Parameter2.qualifiedName(), | 564 method3Parameter2.qualifiedName(), |
| 550 "Unexpected parameter qualifiedName"); | 565 "Unexpected parameter qualifiedName"); |
| 551 Expect.isFalse(method3Parameter2.hasDefaultValue(), | 566 Expect.isFalse(method3Parameter2.hasDefaultValue(), |
| 552 "Parameter has default value"); | 567 "Parameter 'func2' has default value: " |
| 568 "${method3Parameter2.defaultValue()}"); |
| 553 Expect.isNull(method3Parameter2.defaultValue(), | 569 Expect.isNull(method3Parameter2.defaultValue(), |
| 554 "Parameter default value is non-null"); | 570 "Parameter default value is non-null"); |
| 555 Expect.isFalse(method3Parameter2.isOptional(), "Parameter is optional"); | 571 Expect.isFalse(method3Parameter2.isOptional(), "Parameter is optional"); |
| 556 | 572 |
| 557 //////////////////////////////////////////////////////////////////////////// | 573 //////////////////////////////////////////////////////////////////////////// |
| 558 // bool operator==(Object other) => return false; | 574 // bool operator==(Object other) => return false; |
| 559 //////////////////////////////////////////////////////////////////////////// | 575 //////////////////////////////////////////////////////////////////////////// |
| 560 var operator_eq = findMirror(bazClassMembers, "operator", operatorName: '=='); | 576 var operator_eq = findMirror(bazClassMembers, "operator", operatorName: '=='); |
| 561 Expect.isNotNull(operator_eq, "operator == not found"); | 577 Expect.isNotNull(operator_eq, "operator == not found"); |
| 562 Expect.stringEquals('operator', operator_eq.simpleName(), | 578 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, | 630 Expect.stringEquals('negate', operator_negate.operatorName, |
| 615 "Unexpected operatorName"); | 631 "Unexpected operatorName"); |
| 616 | 632 |
| 617 | 633 |
| 618 var bazClassConstructors = bazClass.constructors(); | 634 var bazClassConstructors = bazClass.constructors(); |
| 619 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); | 635 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); |
| 620 Expect.equals(3, bazClassConstructors.length, | 636 Expect.equals(3, bazClassConstructors.length, |
| 621 "Unexpected number of constructors"); | 637 "Unexpected number of constructors"); |
| 622 // TODO(johnniwinther): Add tests of constructors. | 638 // TODO(johnniwinther): Add tests of constructors. |
| 623 } | 639 } |
| OLD | NEW |