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/lib/mirrors.dart"); | 5 #import("../../../pkg/dartdoc/lib/mirrors.dart"); |
6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart"); | 6 #import("../../../pkg/dartdoc/lib/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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 //////////////////////////////////////////////////////////////////////////// | 336 //////////////////////////////////////////////////////////////////////////// |
337 // static method1(e) {} | 337 // static method1(e) {} |
338 //////////////////////////////////////////////////////////////////////////// | 338 //////////////////////////////////////////////////////////////////////////// |
339 var method1 = bazClassMembers["method1"]; | 339 var method1 = bazClassMembers["method1"]; |
340 Expect.isNotNull(method1, "method1 not found"); | 340 Expect.isNotNull(method1, "method1 not found"); |
341 Expect.stringEquals('method1', method1.simpleName, | 341 Expect.stringEquals('method1', method1.simpleName, |
342 "Unexpected method simpleName"); | 342 "Unexpected method simpleName"); |
343 Expect.stringEquals('mirrors_helper.Baz.method1', method1.qualifiedName, | 343 Expect.stringEquals('mirrors_helper.Baz.method1', method1.qualifiedName, |
344 "Unexpected method qualifiedName"); | 344 "Unexpected method qualifiedName"); |
345 Expect.equals(method1.surroundingDeclaration, bazClass, | 345 Expect.equals(method1.owner, bazClass, |
346 "Unexpected surrounding declaration"); | 346 "Unexpected surrounding declaration"); |
347 Expect.isFalse(method1.isTopLevel, "Method is top level"); | 347 Expect.isFalse(method1.isTopLevel, "Method is top level"); |
348 Expect.isFalse(method1.isConstructor, "Method is constructor"); | 348 Expect.isFalse(method1.isConstructor, "Method is constructor"); |
349 Expect.isFalse(method1.isField, "Method is field"); | 349 Expect.isFalse(method1.isField, "Method is field"); |
350 Expect.isTrue(method1.isMethod, "Method is not method"); | 350 Expect.isTrue(method1.isMethod, "Method is not method"); |
351 Expect.isFalse(method1.isPrivate, "Method is private"); | 351 Expect.isFalse(method1.isPrivate, "Method is private"); |
352 Expect.isTrue(method1.isStatic, "Method is not static"); | 352 Expect.isTrue(method1.isStatic, "Method is not static"); |
353 Expect.isTrue(method1 is MethodMirror, "Method is not MethodMirror"); | 353 Expect.isTrue(method1 is MethodMirror, "Method is not MethodMirror"); |
354 Expect.isFalse(method1.isConst, "Method is const"); | 354 Expect.isFalse(method1.isConst, "Method is const"); |
355 Expect.isFalse(method1.isFactory, "Method is factory"); | 355 Expect.isFalse(method1.isFactory, "Method is factory"); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 | 389 |
390 //////////////////////////////////////////////////////////////////////////// | 390 //////////////////////////////////////////////////////////////////////////// |
391 // static void method2(E e, [F f = null]) {} | 391 // static void method2(E e, [F f = null]) {} |
392 //////////////////////////////////////////////////////////////////////////// | 392 //////////////////////////////////////////////////////////////////////////// |
393 var method2 = bazClassMembers["method2"]; | 393 var method2 = bazClassMembers["method2"]; |
394 Expect.isNotNull(method2, "method2 not found"); | 394 Expect.isNotNull(method2, "method2 not found"); |
395 Expect.stringEquals('method2', method2.simpleName, | 395 Expect.stringEquals('method2', method2.simpleName, |
396 "Unexpected method simpleName"); | 396 "Unexpected method simpleName"); |
397 Expect.stringEquals('mirrors_helper.Baz.method2', method2.qualifiedName, | 397 Expect.stringEquals('mirrors_helper.Baz.method2', method2.qualifiedName, |
398 "Unexpected method qualifiedName"); | 398 "Unexpected method qualifiedName"); |
399 Expect.equals(method2.surroundingDeclaration, bazClass, | 399 Expect.equals(method2.owner, bazClass, |
400 "Unexpected surrounding declaration"); | 400 "Unexpected surrounding declaration"); |
401 Expect.isFalse(method2.isTopLevel, "Method is top level"); | 401 Expect.isFalse(method2.isTopLevel, "Method is top level"); |
402 Expect.isFalse(method2.isConstructor, "Method is constructor"); | 402 Expect.isFalse(method2.isConstructor, "Method is constructor"); |
403 Expect.isFalse(method2.isField, "Method is field"); | 403 Expect.isFalse(method2.isField, "Method is field"); |
404 Expect.isTrue(method2.isMethod, "Method is not method"); | 404 Expect.isTrue(method2.isMethod, "Method is not method"); |
405 Expect.isFalse(method2.isPrivate, "Method is private"); | 405 Expect.isFalse(method2.isPrivate, "Method is private"); |
406 Expect.isFalse(method2.isStatic, "Method is static"); | 406 Expect.isFalse(method2.isStatic, "Method is static"); |
407 Expect.isTrue(method2 is MethodMirror, "Method is not MethodMirror"); | 407 Expect.isTrue(method2 is MethodMirror, "Method is not MethodMirror"); |
408 Expect.isFalse(method2.isConst, "Method is const"); | 408 Expect.isFalse(method2.isConst, "Method is const"); |
409 Expect.isFalse(method2.isFactory, "Method is factory"); | 409 Expect.isFalse(method2.isFactory, "Method is factory"); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 | 456 |
457 //////////////////////////////////////////////////////////////////////////// | 457 //////////////////////////////////////////////////////////////////////////// |
458 // Baz<E,F> method3(E func1(F f), Func<E,F> func2) => null; | 458 // Baz<E,F> method3(E func1(F f), Func<E,F> func2) => null; |
459 //////////////////////////////////////////////////////////////////////////// | 459 //////////////////////////////////////////////////////////////////////////// |
460 var method3 = bazClassMembers["method3"]; | 460 var method3 = bazClassMembers["method3"]; |
461 Expect.isNotNull(method3, "method3 not found"); | 461 Expect.isNotNull(method3, "method3 not found"); |
462 Expect.stringEquals('method3', method3.simpleName, | 462 Expect.stringEquals('method3', method3.simpleName, |
463 "Unexpected method simpleName"); | 463 "Unexpected method simpleName"); |
464 Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName, | 464 Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName, |
465 "Unexpected method qualifiedName"); | 465 "Unexpected method qualifiedName"); |
466 Expect.equals(method3.surroundingDeclaration, bazClass, | 466 Expect.equals(method3.owner, bazClass, |
467 "Unexpected surrounding declaration"); | 467 "Unexpected surrounding declaration"); |
468 Expect.isFalse(method3.isTopLevel, "Method is top level"); | 468 Expect.isFalse(method3.isTopLevel, "Method is top level"); |
469 Expect.isFalse(method3.isConstructor, "Method is constructor"); | 469 Expect.isFalse(method3.isConstructor, "Method is constructor"); |
470 Expect.isFalse(method3.isField, "Method is field"); | 470 Expect.isFalse(method3.isField, "Method is field"); |
471 Expect.isTrue(method3.isMethod, "Method is not method"); | 471 Expect.isTrue(method3.isMethod, "Method is not method"); |
472 Expect.isFalse(method3.isPrivate, "Method is private"); | 472 Expect.isFalse(method3.isPrivate, "Method is private"); |
473 Expect.isFalse(method3.isStatic, "Method is static"); | 473 Expect.isFalse(method3.isStatic, "Method is static"); |
474 Expect.isTrue(method3 is MethodMirror, "Method is not MethodMirror"); | 474 Expect.isTrue(method3 is MethodMirror, "Method is not MethodMirror"); |
475 Expect.isFalse(method3.isConst, "Method is const"); | 475 Expect.isFalse(method3.isConst, "Method is const"); |
476 Expect.isFalse(method3.isFactory, "Method is factory"); | 476 Expect.isFalse(method3.isFactory, "Method is factory"); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 // bool operator==(Object other) => false; | 587 // bool operator==(Object other) => false; |
588 //////////////////////////////////////////////////////////////////////////// | 588 //////////////////////////////////////////////////////////////////////////// |
589 var operator_eq = bazClassMembers['==']; | 589 var operator_eq = bazClassMembers['==']; |
590 Expect.isNotNull(operator_eq, "operator == not found"); | 590 Expect.isNotNull(operator_eq, "operator == not found"); |
591 Expect.stringEquals('==', operator_eq.simpleName, | 591 Expect.stringEquals('==', operator_eq.simpleName, |
592 "Unexpected method simpleName"); | 592 "Unexpected method simpleName"); |
593 Expect.stringEquals('operator ==', operator_eq.displayName); | 593 Expect.stringEquals('operator ==', operator_eq.displayName); |
594 Expect.stringEquals('mirrors_helper.Baz.==', | 594 Expect.stringEquals('mirrors_helper.Baz.==', |
595 operator_eq.qualifiedName, | 595 operator_eq.qualifiedName, |
596 "Unexpected method qualifiedName"); | 596 "Unexpected method qualifiedName"); |
597 Expect.equals(operator_eq.surroundingDeclaration, bazClass, | 597 Expect.equals(operator_eq.owner, bazClass, |
598 "Unexpected surrounding declaration"); | 598 "Unexpected surrounding declaration"); |
599 Expect.isFalse(operator_eq.isTopLevel, "Method is top level"); | 599 Expect.isFalse(operator_eq.isTopLevel, "Method is top level"); |
600 Expect.isFalse(operator_eq.isConstructor, "Method is constructor"); | 600 Expect.isFalse(operator_eq.isConstructor, "Method is constructor"); |
601 Expect.isFalse(operator_eq.isField, "Method is field"); | 601 Expect.isFalse(operator_eq.isField, "Method is field"); |
602 Expect.isTrue(operator_eq.isMethod, "Method is not method"); | 602 Expect.isTrue(operator_eq.isMethod, "Method is not method"); |
603 Expect.isFalse(operator_eq.isPrivate, "Method is private"); | 603 Expect.isFalse(operator_eq.isPrivate, "Method is private"); |
604 Expect.isFalse(operator_eq.isStatic, "Method is static"); | 604 Expect.isFalse(operator_eq.isStatic, "Method is static"); |
605 Expect.isTrue(operator_eq is MethodMirror, "Method is not MethodMirror"); | 605 Expect.isTrue(operator_eq is MethodMirror, "Method is not MethodMirror"); |
606 Expect.isFalse(operator_eq.isConst, "Method is const"); | 606 Expect.isFalse(operator_eq.isConst, "Method is const"); |
607 Expect.isFalse(operator_eq.isFactory, "Method is factory"); | 607 Expect.isFalse(operator_eq.isFactory, "Method is factory"); |
608 Expect.isNull(operator_eq.constructorName, | 608 Expect.isNull(operator_eq.constructorName, |
609 "Method constructorName is non-null"); | 609 "Method constructorName is non-null"); |
610 Expect.isFalse(operator_eq.isGetter, "Method is getter"); | 610 Expect.isFalse(operator_eq.isGetter, "Method is getter"); |
611 Expect.isFalse(operator_eq.isSetter, "Method is setter"); | 611 Expect.isFalse(operator_eq.isSetter, "Method is setter"); |
612 Expect.isTrue(operator_eq.isOperator, "Method is not operator"); | 612 Expect.isTrue(operator_eq.isOperator, "Method is not operator"); |
613 Expect.stringEquals('==', operator_eq.operatorName, | 613 Expect.stringEquals('==', operator_eq.operatorName, |
614 "Unexpected operatorName"); | 614 "Unexpected operatorName"); |
615 | 615 |
616 //////////////////////////////////////////////////////////////////////////// | 616 //////////////////////////////////////////////////////////////////////////// |
617 // int operator -() => 0; | 617 // int operator -() => 0; |
618 //////////////////////////////////////////////////////////////////////////// | 618 //////////////////////////////////////////////////////////////////////////// |
619 var operator_negate = bazClassMembers[Mirror.UNARY_MINUS]; | 619 var operator_negate = bazClassMembers[Mirror.UNARY_MINUS]; |
620 Expect.isNotNull(operator_negate, "operator < not found"); | 620 Expect.isNotNull(operator_negate, "operator < not found"); |
621 Expect.stringEquals(Mirror.UNARY_MINUS, operator_negate.simpleName, | 621 Expect.stringEquals(Mirror.UNARY_MINUS, operator_negate.simpleName, |
622 "Unexpected method simpleName"); | 622 "Unexpected method simpleName"); |
623 Expect.stringEquals('operator -', operator_negate.displayName); | 623 Expect.stringEquals('operator -', operator_negate.displayName); |
624 Expect.stringEquals('mirrors_helper.Baz.${Mirror.UNARY_MINUS}', | 624 Expect.stringEquals('mirrors_helper.Baz.${Mirror.UNARY_MINUS}', |
625 operator_negate.qualifiedName, | 625 operator_negate.qualifiedName, |
626 "Unexpected method qualifiedName"); | 626 "Unexpected method qualifiedName"); |
627 Expect.equals(operator_negate.surroundingDeclaration, bazClass, | 627 Expect.equals(operator_negate.owner, bazClass, |
628 "Unexpected surrounding declaration"); | 628 "Unexpected surrounding declaration"); |
629 Expect.isFalse(operator_negate.isTopLevel, "Method is top level"); | 629 Expect.isFalse(operator_negate.isTopLevel, "Method is top level"); |
630 Expect.isFalse(operator_negate.isConstructor, "Method is constructor"); | 630 Expect.isFalse(operator_negate.isConstructor, "Method is constructor"); |
631 Expect.isFalse(operator_negate.isField, "Method is field"); | 631 Expect.isFalse(operator_negate.isField, "Method is field"); |
632 Expect.isTrue(operator_negate.isMethod, "Method is not method"); | 632 Expect.isTrue(operator_negate.isMethod, "Method is not method"); |
633 Expect.isFalse(operator_negate.isPrivate, "Method is private"); | 633 Expect.isFalse(operator_negate.isPrivate, "Method is private"); |
634 Expect.isFalse(operator_negate.isStatic, "Method is static"); | 634 Expect.isFalse(operator_negate.isStatic, "Method is static"); |
635 Expect.isTrue(operator_negate is MethodMirror, | 635 Expect.isTrue(operator_negate is MethodMirror, |
636 "Method is not MethodMirror"); | 636 "Method is not MethodMirror"); |
637 Expect.isFalse(operator_negate.isConst, "Method is const"); | 637 Expect.isFalse(operator_negate.isConst, "Method is const"); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 Expect.isTrue(privateConstructor.isConstructor); | 732 Expect.isTrue(privateConstructor.isConstructor); |
733 Expect.isTrue(privateConstructor.isPrivate); | 733 Expect.isTrue(privateConstructor.isPrivate); |
734 | 734 |
735 var privateFactoryConstructor = | 735 var privateFactoryConstructor = |
736 privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor']; | 736 privateClass.declaredMembers['_PrivateClass._privateFactoryConstructor']; |
737 Expect.isNotNull(privateFactoryConstructor); | 737 Expect.isNotNull(privateFactoryConstructor); |
738 Expect.isTrue(privateFactoryConstructor is MethodMirror); | 738 Expect.isTrue(privateFactoryConstructor is MethodMirror); |
739 Expect.isTrue(privateFactoryConstructor.isFactory); | 739 Expect.isTrue(privateFactoryConstructor.isFactory); |
740 Expect.isTrue(privateFactoryConstructor.isPrivate); | 740 Expect.isTrue(privateFactoryConstructor.isPrivate); |
741 } | 741 } |
OLD | NEW |