| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.all_the_rest_test; | 8 library engine.all_the_rest_test; |
| 9 | 9 |
| 10 import 'dart:collection'; | 10 import 'dart:collection'; |
| 11 | 11 |
| 12 import 'package:analyzer/file_system/file_system.dart'; |
| 13 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 12 import 'package:analyzer/file_system/physical_file_system.dart'; | 14 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 15 import 'package:analyzer/source/package_map_resolver.dart'; |
| 13 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 16 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
| 14 import 'package:analyzer/src/generated/constant.dart'; | 17 import 'package:analyzer/src/generated/constant.dart'; |
| 15 import 'package:analyzer/src/generated/element.dart'; | 18 import 'package:analyzer/src/generated/element.dart'; |
| 16 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 17 import 'package:analyzer/src/generated/error.dart'; | 20 import 'package:analyzer/src/generated/error.dart'; |
| 18 import 'package:analyzer/src/generated/html.dart' as ht; | 21 import 'package:analyzer/src/generated/html.dart' as ht; |
| 19 import 'package:analyzer/src/generated/java_core.dart'; | 22 import 'package:analyzer/src/generated/java_core.dart'; |
| 20 import 'package:analyzer/src/generated/java_engine.dart'; | 23 import 'package:analyzer/src/generated/java_engine.dart'; |
| 21 import 'package:analyzer/src/generated/java_engine_io.dart'; | 24 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 22 import 'package:analyzer/src/generated/java_io.dart'; | 25 import 'package:analyzer/src/generated/java_io.dart'; |
| 23 import 'package:analyzer/src/generated/resolver.dart'; | 26 import 'package:analyzer/src/generated/resolver.dart'; |
| 24 import 'package:analyzer/src/generated/scanner.dart'; | 27 import 'package:analyzer/src/generated/scanner.dart'; |
| 25 import 'package:analyzer/src/generated/sdk.dart'; | 28 import 'package:analyzer/src/generated/sdk.dart'; |
| 26 import 'package:analyzer/src/generated/sdk_io.dart'; | 29 import 'package:analyzer/src/generated/sdk_io.dart'; |
| 27 import 'package:analyzer/src/generated/source.dart'; | 30 import 'package:analyzer/src/generated/source.dart'; |
| 28 import 'package:analyzer/src/generated/source_io.dart'; | 31 import 'package:analyzer/src/generated/source_io.dart'; |
| 29 import 'package:analyzer/src/generated/testing/ast_factory.dart'; | 32 import 'package:analyzer/src/generated/testing/ast_factory.dart'; |
| 30 import 'package:analyzer/src/generated/testing/element_factory.dart'; | 33 import 'package:analyzer/src/generated/testing/element_factory.dart'; |
| 31 import 'package:analyzer/src/generated/testing/html_factory.dart'; | 34 import 'package:analyzer/src/generated/testing/html_factory.dart'; |
| 32 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 35 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 33 import 'package:analyzer/src/generated/utilities_collection.dart'; | 36 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 34 import 'package:analyzer/src/generated/utilities_dart.dart'; | 37 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 38 import 'package:path/src/context.dart'; |
| 35 import 'package:unittest/unittest.dart'; | 39 import 'package:unittest/unittest.dart'; |
| 36 | 40 |
| 37 import '../reflective_tests.dart'; | 41 import '../reflective_tests.dart'; |
| 38 import 'parser_test.dart'; | 42 import 'parser_test.dart'; |
| 39 import 'resolver_test.dart'; | 43 import 'resolver_test.dart'; |
| 40 import 'test_support.dart'; | 44 import 'test_support.dart'; |
| 41 import 'package:analyzer/source/package_map_resolver.dart'; | |
| 42 import 'package:analyzer/file_system/memory_file_system.dart'; | |
| 43 import 'package:analyzer/file_system/file_system.dart'; | |
| 44 import 'package:path/src/context.dart'; | |
| 45 | 45 |
| 46 | 46 |
| 47 main() { | 47 main() { |
| 48 groupSep = ' | '; | 48 groupSep = ' | '; |
| 49 runReflectiveTests(ConstantEvaluatorTest); | 49 runReflectiveTests(ConstantEvaluatorTest); |
| 50 runReflectiveTests(ConstantFinderTest); | 50 runReflectiveTests(ConstantFinderTest); |
| 51 runReflectiveTests(ConstantValueComputerTest); | 51 runReflectiveTests(ConstantValueComputerTest); |
| 52 runReflectiveTests(ConstantVisitorTest); | 52 runReflectiveTests(ConstantVisitorTest); |
| 53 runReflectiveTests(ContentCacheTest); | 53 runReflectiveTests(ContentCacheTest); |
| 54 runReflectiveTests(CustomUriResolverTest); | 54 runReflectiveTests(CustomUriResolverTest); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 expect(value, null); | 501 expect(value, null); |
| 502 } | 502 } |
| 503 | 503 |
| 504 void fail_identifier_typeParameter() { | 504 void fail_identifier_typeParameter() { |
| 505 EvaluationResult result = _getExpressionValue("?"); | 505 EvaluationResult result = _getExpressionValue("?"); |
| 506 expect(result.isValid, isTrue); | 506 expect(result.isValid, isTrue); |
| 507 DartObject value = result.value; | 507 DartObject value = result.value; |
| 508 expect(value, null); | 508 expect(value, null); |
| 509 } | 509 } |
| 510 | 510 |
| 511 void fail_plus_string_string() { | |
| 512 _assertValue4("ab", "'a' + 'b'"); | |
| 513 } | |
| 514 | |
| 515 void fail_prefixedIdentifier_invalid() { | 511 void fail_prefixedIdentifier_invalid() { |
| 516 EvaluationResult result = _getExpressionValue("?"); | 512 EvaluationResult result = _getExpressionValue("?"); |
| 517 expect(result.isValid, isTrue); | 513 expect(result.isValid, isTrue); |
| 518 DartObject value = result.value; | 514 DartObject value = result.value; |
| 519 expect(value, null); | 515 expect(value, null); |
| 520 } | 516 } |
| 521 | 517 |
| 522 void fail_prefixedIdentifier_valid() { | 518 void fail_prefixedIdentifier_valid() { |
| 523 EvaluationResult result = _getExpressionValue("?"); | 519 EvaluationResult result = _getExpressionValue("?"); |
| 524 expect(result.isValid, isTrue); | 520 expect(result.isValid, isTrue); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 547 expect(value, null); | 543 expect(value, null); |
| 548 } | 544 } |
| 549 | 545 |
| 550 void fail_simpleIdentifier_valid() { | 546 void fail_simpleIdentifier_valid() { |
| 551 EvaluationResult result = _getExpressionValue("?"); | 547 EvaluationResult result = _getExpressionValue("?"); |
| 552 expect(result.isValid, isTrue); | 548 expect(result.isValid, isTrue); |
| 553 DartObject value = result.value; | 549 DartObject value = result.value; |
| 554 expect(value, null); | 550 expect(value, null); |
| 555 } | 551 } |
| 556 | 552 |
| 557 void fail_stringLength_complex() { | |
| 558 _assertValue3(6, "('qwe' + 'rty').length"); | |
| 559 } | |
| 560 | |
| 561 void fail_stringLength_simple() { | |
| 562 _assertValue3(6, "'Dvorak'.length"); | |
| 563 } | |
| 564 | |
| 565 void test_bitAnd_int_int() { | 553 void test_bitAnd_int_int() { |
| 566 _assertValue3(74 & 42, "74 & 42"); | 554 _assertValue3(74 & 42, "74 & 42"); |
| 567 } | 555 } |
| 568 | 556 |
| 569 void test_bitNot() { | 557 void test_bitNot() { |
| 570 _assertValue3(~42, "~42"); | 558 _assertValue3(~42, "~42"); |
| 571 } | 559 } |
| 572 | 560 |
| 573 void test_bitOr_int_int() { | 561 void test_bitOr_int_int() { |
| 574 _assertValue3(74 | 42, "74 | 42"); | 562 _assertValue3(74 | 42, "74 | 42"); |
| 575 } | 563 } |
| 576 | 564 |
| 577 void test_bitXor_int_int() { | 565 void test_bitXor_int_int() { |
| 578 _assertValue3(74 ^ 42, "74 ^ 42"); | 566 _assertValue3(74 ^ 42, "74 ^ 42"); |
| 579 } | 567 } |
| 568 |
| 580 void test_divide_double_double() { | 569 void test_divide_double_double() { |
| 581 _assertValue2(3.2 / 2.3, "3.2 / 2.3"); | 570 _assertValue2(3.2 / 2.3, "3.2 / 2.3"); |
| 582 } | 571 } |
| 583 | 572 |
| 584 void test_divide_double_double_byZero() { | 573 void test_divide_double_double_byZero() { |
| 585 EvaluationResult result = _getExpressionValue("3.2 / 0.0"); | 574 EvaluationResult result = _getExpressionValue("3.2 / 0.0"); |
| 586 expect(result.isValid, isTrue); | 575 expect(result.isValid, isTrue); |
| 587 DartObject value = result.value; | 576 DartObject value = result.value; |
| 588 expect(value.type.name, "double"); | 577 expect(value.type.name, "double"); |
| 589 expect(value.doubleValue.isInfinite, isTrue); | 578 expect(value.doubleValue.isInfinite, isTrue); |
| 590 } | 579 } |
| 591 | 580 |
| 592 void test_divide_int_int() { | 581 void test_divide_int_int() { |
| 593 _assertValue3(1, "3 / 2"); | 582 _assertValue3(1, "3 / 2"); |
| 594 } | 583 } |
| 595 | |
| 596 void test_divide_int_int_byZero() { | 584 void test_divide_int_int_byZero() { |
| 597 EvaluationResult result = _getExpressionValue("3 / 0"); | 585 EvaluationResult result = _getExpressionValue("3 / 0"); |
| 598 expect(result.isValid, isTrue); | 586 expect(result.isValid, isTrue); |
| 599 } | 587 } |
| 600 | 588 |
| 601 void test_equal_boolean_boolean() { | 589 void test_equal_boolean_boolean() { |
| 602 _assertValue(false, "true == false"); | 590 _assertValue(false, "true == false"); |
| 603 } | 591 } |
| 604 | 592 |
| 605 void test_equal_int_int() { | 593 void test_equal_int_int() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 624 _assertValue(false, "2 > 3"); | 612 _assertValue(false, "2 > 3"); |
| 625 } | 613 } |
| 626 | 614 |
| 627 void test_greaterThanOrEqual_int_int() { | 615 void test_greaterThanOrEqual_int_int() { |
| 628 _assertValue(false, "2 >= 3"); | 616 _assertValue(false, "2 >= 3"); |
| 629 } | 617 } |
| 630 | 618 |
| 631 void test_leftShift_int_int() { | 619 void test_leftShift_int_int() { |
| 632 _assertValue3(64, "16 << 2"); | 620 _assertValue3(64, "16 << 2"); |
| 633 } | 621 } |
| 622 |
| 634 void test_lessThan_int_int() { | 623 void test_lessThan_int_int() { |
| 635 _assertValue(true, "2 < 3"); | 624 _assertValue(true, "2 < 3"); |
| 636 } | 625 } |
| 637 | 626 |
| 638 void test_lessThanOrEqual_int_int() { | 627 void test_lessThanOrEqual_int_int() { |
| 639 _assertValue(true, "2 <= 3"); | 628 _assertValue(true, "2 <= 3"); |
| 640 } | 629 } |
| 641 | 630 |
| 642 void test_literal_boolean_false() { | 631 void test_literal_boolean_false() { |
| 643 _assertValue(false, "false"); | 632 _assertValue(false, "false"); |
| 644 } | 633 } |
| 645 | |
| 646 void test_literal_boolean_true() { | 634 void test_literal_boolean_true() { |
| 647 _assertValue(true, "true"); | 635 _assertValue(true, "true"); |
| 648 } | 636 } |
| 649 | 637 |
| 650 void test_literal_list() { | 638 void test_literal_list() { |
| 651 EvaluationResult result = _getExpressionValue("const ['a', 'b', 'c']"); | 639 EvaluationResult result = _getExpressionValue("const ['a', 'b', 'c']"); |
| 652 expect(result.isValid, isTrue); | 640 expect(result.isValid, isTrue); |
| 653 } | 641 } |
| 654 | 642 |
| 655 void test_literal_map() { | 643 void test_literal_map() { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 } | 738 } |
| 751 | 739 |
| 752 void test_plus_double_double() { | 740 void test_plus_double_double() { |
| 753 _assertValue2(2.3 + 3.2, "2.3 + 3.2"); | 741 _assertValue2(2.3 + 3.2, "2.3 + 3.2"); |
| 754 } | 742 } |
| 755 | 743 |
| 756 void test_plus_int_int() { | 744 void test_plus_int_int() { |
| 757 _assertValue3(5, "2 + 3"); | 745 _assertValue3(5, "2 + 3"); |
| 758 } | 746 } |
| 759 | 747 |
| 748 void test_plus_string_string() { |
| 749 _assertValue4("ab", "'a' + 'b'"); |
| 750 } |
| 751 |
| 760 void test_remainder_double_double() { | 752 void test_remainder_double_double() { |
| 761 _assertValue2(3.2 % 2.3, "3.2 % 2.3"); | 753 _assertValue2(3.2 % 2.3, "3.2 % 2.3"); |
| 762 } | 754 } |
| 763 | 755 |
| 764 void test_remainder_int_int() { | 756 void test_remainder_int_int() { |
| 765 _assertValue3(2, "8 % 3"); | 757 _assertValue3(2, "8 % 3"); |
| 766 } | 758 } |
| 767 | 759 |
| 768 void test_rightShift() { | 760 void test_rightShift() { |
| 769 _assertValue3(16, "64 >> 2"); | 761 _assertValue3(16, "64 >> 2"); |
| 770 } | 762 } |
| 771 | 763 |
| 764 void test_stringLength_complex() { |
| 765 _assertValue3(6, "('qwe' + 'rty').length"); |
| 766 } |
| 767 |
| 768 void test_stringLength_simple() { |
| 769 _assertValue3(6, "'Dvorak'.length"); |
| 770 } |
| 771 |
| 772 void test_times_double_double() { | 772 void test_times_double_double() { |
| 773 _assertValue2(2.3 * 3.2, "2.3 * 3.2"); | 773 _assertValue2(2.3 * 3.2, "2.3 * 3.2"); |
| 774 } | 774 } |
| 775 | 775 |
| 776 void test_times_int_int() { | 776 void test_times_int_int() { |
| 777 _assertValue3(6, "2 * 3"); | 777 _assertValue3(6, "2 * 3"); |
| 778 } | 778 } |
| 779 | 779 |
| 780 void test_truncatingDivide_double_double() { | 780 void test_truncatingDivide_double_double() { |
| 781 _assertValue3(1, "3.2 ~/ 2.3"); | 781 _assertValue3(1, "3.2 ~/ 2.3"); |
| (...skipping 1625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2407 @reflectiveTest | 2407 @reflectiveTest |
| 2408 class CustomUriResolverTest { | 2408 class CustomUriResolverTest { |
| 2409 void test_creation() { | 2409 void test_creation() { |
| 2410 expect(new CustomUriResolver({}), isNotNull); | 2410 expect(new CustomUriResolver({}), isNotNull); |
| 2411 } | 2411 } |
| 2412 | 2412 |
| 2413 void test_resolve_unknown_uri() { | 2413 void test_resolve_unknown_uri() { |
| 2414 UriResolver resolver = new CustomUriResolver({ | 2414 UriResolver resolver = new CustomUriResolver({ |
| 2415 'custom:library': '/path/to/library.dart', | 2415 'custom:library': '/path/to/library.dart', |
| 2416 }); | 2416 }); |
| 2417 Source result = resolver.resolveAbsolute( | 2417 Source result = |
| 2418 parseUriWithException("custom:non_library")); | 2418 resolver.resolveAbsolute(parseUriWithException("custom:non_library")); |
| 2419 expect(result, isNull); | 2419 expect(result, isNull); |
| 2420 } | 2420 } |
| 2421 | 2421 |
| 2422 void test_resolve_uri() { | 2422 void test_resolve_uri() { |
| 2423 String path = | 2423 String path = |
| 2424 FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath(); | 2424 FileUtilities2.createFile("/path/to/library.dart").getAbsolutePath(); |
| 2425 UriResolver resolver = new CustomUriResolver({ | 2425 UriResolver resolver = new CustomUriResolver({ |
| 2426 'custom:library': path, | 2426 'custom:library': path, |
| 2427 }); | 2427 }); |
| 2428 Source result = resolver.resolveAbsolute( | 2428 Source result = |
| 2429 parseUriWithException("custom:library")); | 2429 resolver.resolveAbsolute(parseUriWithException("custom:library")); |
| 2430 expect(result, isNotNull); | 2430 expect(result, isNotNull); |
| 2431 expect(result.fullName, path); | 2431 expect(result.fullName, path); |
| 2432 } | 2432 } |
| 2433 } | 2433 } |
| 2434 | 2434 |
| 2435 | 2435 |
| 2436 @reflectiveTest | 2436 @reflectiveTest |
| 2437 class DartObjectImplTest extends EngineTestCase { | 2437 class DartObjectImplTest extends EngineTestCase { |
| 2438 TypeProvider _typeProvider = new TestTypeProvider(); | 2438 TypeProvider _typeProvider = new TestTypeProvider(); |
| 2439 | 2439 |
| 2440 void fail_add_knownString_knownString() { | |
| 2441 fail("New constant semantics are not yet enabled"); | |
| 2442 _assertAdd(_stringValue("ab"), _stringValue("a"), _stringValue("b")); | |
| 2443 } | |
| 2444 | |
| 2445 void fail_add_knownString_unknownString() { | |
| 2446 fail("New constant semantics are not yet enabled"); | |
| 2447 _assertAdd(_stringValue(null), _stringValue("a"), _stringValue(null)); | |
| 2448 } | |
| 2449 | |
| 2450 void fail_add_unknownString_knownString() { | |
| 2451 fail("New constant semantics are not yet enabled"); | |
| 2452 _assertAdd(_stringValue(null), _stringValue(null), _stringValue("b")); | |
| 2453 } | |
| 2454 void fail_add_unknownString_unknownString() { | |
| 2455 fail("New constant semantics are not yet enabled"); | |
| 2456 _assertAdd(_stringValue(null), _stringValue(null), _stringValue(null)); | |
| 2457 } | |
| 2458 | |
| 2459 void test_add_knownDouble_knownDouble() { | 2440 void test_add_knownDouble_knownDouble() { |
| 2460 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _doubleValue(2.0)); | 2441 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _doubleValue(2.0)); |
| 2461 } | 2442 } |
| 2462 | 2443 |
| 2463 void test_add_knownDouble_knownInt() { | 2444 void test_add_knownDouble_knownInt() { |
| 2464 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _intValue(2)); | 2445 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _intValue(2)); |
| 2465 } | 2446 } |
| 2466 | 2447 |
| 2467 void test_add_knownDouble_unknownDouble() { | 2448 void test_add_knownDouble_unknownDouble() { |
| 2468 _assertAdd(_doubleValue(null), _doubleValue(1.0), _doubleValue(null)); | 2449 _assertAdd(_doubleValue(null), _doubleValue(1.0), _doubleValue(null)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2485 } | 2466 } |
| 2486 | 2467 |
| 2487 void test_add_knownInt_unknownInt() { | 2468 void test_add_knownInt_unknownInt() { |
| 2488 _assertAdd(_intValue(null), _intValue(1), _intValue(null)); | 2469 _assertAdd(_intValue(null), _intValue(1), _intValue(null)); |
| 2489 } | 2470 } |
| 2490 | 2471 |
| 2491 void test_add_knownString_knownInt() { | 2472 void test_add_knownString_knownInt() { |
| 2492 _assertAdd(null, _stringValue("1"), _intValue(2)); | 2473 _assertAdd(null, _stringValue("1"), _intValue(2)); |
| 2493 } | 2474 } |
| 2494 | 2475 |
| 2476 void test_add_knownString_knownString() { |
| 2477 _assertAdd(_stringValue("ab"), _stringValue("a"), _stringValue("b")); |
| 2478 } |
| 2479 |
| 2480 void test_add_knownString_unknownString() { |
| 2481 _assertAdd(_stringValue(null), _stringValue("a"), _stringValue(null)); |
| 2482 } |
| 2483 |
| 2495 void test_add_unknownDouble_knownDouble() { | 2484 void test_add_unknownDouble_knownDouble() { |
| 2496 _assertAdd(_doubleValue(null), _doubleValue(null), _doubleValue(2.0)); | 2485 _assertAdd(_doubleValue(null), _doubleValue(null), _doubleValue(2.0)); |
| 2497 } | 2486 } |
| 2498 | 2487 |
| 2499 void test_add_unknownDouble_knownInt() { | 2488 void test_add_unknownDouble_knownInt() { |
| 2500 _assertAdd(_doubleValue(null), _doubleValue(null), _intValue(2)); | 2489 _assertAdd(_doubleValue(null), _doubleValue(null), _intValue(2)); |
| 2501 } | 2490 } |
| 2502 | 2491 |
| 2503 void test_add_unknownInt_knownDouble() { | 2492 void test_add_unknownInt_knownDouble() { |
| 2504 _assertAdd(_doubleValue(null), _intValue(null), _doubleValue(2.0)); | 2493 _assertAdd(_doubleValue(null), _intValue(null), _doubleValue(2.0)); |
| 2505 } | 2494 } |
| 2506 | 2495 |
| 2507 void test_add_unknownInt_knownInt() { | 2496 void test_add_unknownInt_knownInt() { |
| 2508 _assertAdd(_intValue(null), _intValue(null), _intValue(2)); | 2497 _assertAdd(_intValue(null), _intValue(null), _intValue(2)); |
| 2509 } | 2498 } |
| 2499 |
| 2500 void test_add_unknownString_knownString() { |
| 2501 _assertAdd(_stringValue(null), _stringValue(null), _stringValue("b")); |
| 2502 } |
| 2503 |
| 2504 void test_add_unknownString_unknownString() { |
| 2505 _assertAdd(_stringValue(null), _stringValue(null), _stringValue(null)); |
| 2506 } |
| 2510 void test_bitAnd_knownInt_knownInt() { | 2507 void test_bitAnd_knownInt_knownInt() { |
| 2511 _assertBitAnd(_intValue(2), _intValue(6), _intValue(3)); | 2508 _assertBitAnd(_intValue(2), _intValue(6), _intValue(3)); |
| 2512 } | 2509 } |
| 2513 | 2510 |
| 2514 void test_bitAnd_knownInt_knownString() { | 2511 void test_bitAnd_knownInt_knownString() { |
| 2515 _assertBitAnd(null, _intValue(6), _stringValue("3")); | 2512 _assertBitAnd(null, _intValue(6), _stringValue("3")); |
| 2516 } | 2513 } |
| 2517 | 2514 |
| 2518 void test_bitAnd_knownInt_unknownInt() { | 2515 void test_bitAnd_knownInt_unknownInt() { |
| 2519 _assertBitAnd(_intValue(null), _intValue(6), _intValue(null)); | 2516 _assertBitAnd(_intValue(null), _intValue(6), _intValue(null)); |
| (...skipping 6027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8547 new FileBasedSource.con1(FileUtilities2.createFile("/does/not/have.dart"
)); | 8544 new FileBasedSource.con1(FileUtilities2.createFile("/does/not/have.dart"
)); |
| 8548 Source result = factory.resolveUri(containingSource, "exist.dart"); | 8545 Source result = factory.resolveUri(containingSource, "exist.dart"); |
| 8549 expect( | 8546 expect( |
| 8550 result.fullName, | 8547 result.fullName, |
| 8551 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); | 8548 FileUtilities2.createFile("/does/not/exist.dart").getAbsolutePath()); |
| 8552 } | 8549 } |
| 8553 | 8550 |
| 8554 void test_resolveUri_nonAbsolute_relative_package() { | 8551 void test_resolveUri_nonAbsolute_relative_package() { |
| 8555 MemoryResourceProvider provider = new MemoryResourceProvider(); | 8552 MemoryResourceProvider provider = new MemoryResourceProvider(); |
| 8556 Context context = provider.pathContext; | 8553 Context context = provider.pathContext; |
| 8557 String packagePath = context.joinAll([context.separator, 'path', 'to', 'pack
age']); | 8554 String packagePath = |
| 8555 context.joinAll([context.separator, 'path', 'to', 'package']); |
| 8558 String libPath = context.joinAll([packagePath, 'lib']); | 8556 String libPath = context.joinAll([packagePath, 'lib']); |
| 8559 String dirPath = context.joinAll([libPath, 'dir']); | 8557 String dirPath = context.joinAll([libPath, 'dir']); |
| 8560 String firstPath = context.joinAll([dirPath, 'first.dart']); | 8558 String firstPath = context.joinAll([dirPath, 'first.dart']); |
| 8561 String secondPath = context.joinAll([dirPath, 'second.dart']); | 8559 String secondPath = context.joinAll([dirPath, 'second.dart']); |
| 8562 | 8560 |
| 8563 provider.newFolder(packagePath); | 8561 provider.newFolder(packagePath); |
| 8564 Folder libFolder = provider.newFolder(libPath); | 8562 Folder libFolder = provider.newFolder(libPath); |
| 8565 provider.newFolder(dirPath); | 8563 provider.newFolder(dirPath); |
| 8566 File firstFile = provider.newFile(firstPath, ''); | 8564 File firstFile = provider.newFile(firstPath, ''); |
| 8567 provider.newFile(secondPath, ''); | 8565 provider.newFile(secondPath, ''); |
| 8568 | 8566 |
| 8569 PackageMapUriResolver resolver = new PackageMapUriResolver(provider, {'packa
ge' : [libFolder]}); | 8567 PackageMapUriResolver resolver = new PackageMapUriResolver(provider, { |
| 8568 'package': [libFolder] |
| 8569 }); |
| 8570 SourceFactory factory = new SourceFactory([resolver]); | 8570 SourceFactory factory = new SourceFactory([resolver]); |
| 8571 Source librarySource = firstFile.createSource(Uri.parse('package:package/dir
/first.dart')); | 8571 Source librarySource = |
| 8572 firstFile.createSource(Uri.parse('package:package/dir/first.dart')); |
| 8572 | 8573 |
| 8573 Source result = factory.resolveUri(librarySource, 'second.dart'); | 8574 Source result = factory.resolveUri(librarySource, 'second.dart'); |
| 8574 expect(result, isNotNull); | 8575 expect(result, isNotNull); |
| 8575 expect(result.fullName, secondPath); | 8576 expect(result.fullName, secondPath); |
| 8576 expect(result.uri.toString(), 'package:package/dir/second.dart'); | 8577 expect(result.uri.toString(), 'package:package/dir/second.dart'); |
| 8577 } | 8578 } |
| 8578 | 8579 |
| 8579 void test_restoreUri() { | 8580 void test_restoreUri() { |
| 8580 JavaFile file1 = FileUtilities2.createFile("/some/file1.dart"); | 8581 JavaFile file1 = FileUtilities2.createFile("/some/file1.dart"); |
| 8581 JavaFile file2 = FileUtilities2.createFile("/some/file2.dart"); | 8582 JavaFile file2 = FileUtilities2.createFile("/some/file2.dart"); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9075 } else { | 9076 } else { |
| 9076 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); | 9077 expect(scriptSource, isNotNull, reason: "script $scriptIndex"); |
| 9077 String actualExternalScriptName = scriptSource.shortName; | 9078 String actualExternalScriptName = scriptSource.shortName; |
| 9078 expect( | 9079 expect( |
| 9079 actualExternalScriptName, | 9080 actualExternalScriptName, |
| 9080 _expectedExternalScriptName, | 9081 _expectedExternalScriptName, |
| 9081 reason: "script $scriptIndex"); | 9082 reason: "script $scriptIndex"); |
| 9082 } | 9083 } |
| 9083 } | 9084 } |
| 9084 } | 9085 } |
| OLD | NEW |