| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library analyzer.test.src.dart.constant.value_test; | 5 library analyzer.test.src.dart.constant.value_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/constant.dart'; | 7 import 'package:analyzer/src/generated/constant.dart'; |
| 8 import 'package:analyzer/src/generated/resolver.dart'; | 8 import 'package:analyzer/src/generated/resolver.dart'; |
| 9 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; | 9 import 'package:analyzer/src/generated/testing/test_type_provider.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
| 12 | 12 |
| 13 import '../../../generated/test_support.dart'; | 13 import '../../../generated/test_support.dart'; |
| 14 import '../../../utils.dart'; | 14 import '../../../utils.dart'; |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 initializeTestEnvironment(); | 17 initializeTestEnvironment(); |
| 18 defineReflectiveTests(DartObjectImplTest); | 18 defineReflectiveTests(DartObjectImplTest); |
| 19 } | 19 } |
| 20 | 20 |
| 21 const Matcher isEvaluationException = const isInstanceOf<EvaluationException>(); |
| 22 |
| 21 const int LONG_MAX_VALUE = 0x7fffffffffffffff; | 23 const int LONG_MAX_VALUE = 0x7fffffffffffffff; |
| 22 | 24 |
| 25 const Matcher throwsEvaluationException = const Throws(isEvaluationException); |
| 26 |
| 23 @reflectiveTest | 27 @reflectiveTest |
| 24 class DartObjectImplTest extends EngineTestCase { | 28 class DartObjectImplTest extends EngineTestCase { |
| 25 TypeProvider _typeProvider = new TestTypeProvider(); | 29 TypeProvider _typeProvider = new TestTypeProvider(); |
| 26 | 30 |
| 27 void test_add_knownDouble_knownDouble() { | 31 void test_add_knownDouble_knownDouble() { |
| 28 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _doubleValue(2.0)); | 32 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _doubleValue(2.0)); |
| 29 } | 33 } |
| 30 | 34 |
| 31 void test_add_knownDouble_knownInt() { | 35 void test_add_knownDouble_knownInt() { |
| 32 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _intValue(2)); | 36 _assertAdd(_doubleValue(3.0), _doubleValue(1.0), _intValue(2)); |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 958 |
| 955 void test_lessThanOrEqual_unknownInt_knownInt() { | 959 void test_lessThanOrEqual_unknownInt_knownInt() { |
| 956 _assertLessThanOrEqual(_boolValue(null), _intValue(null), _intValue(2)); | 960 _assertLessThanOrEqual(_boolValue(null), _intValue(null), _intValue(2)); |
| 957 } | 961 } |
| 958 | 962 |
| 959 void test_logicalAnd_false_false() { | 963 void test_logicalAnd_false_false() { |
| 960 _assertLogicalAnd(_boolValue(false), _boolValue(false), _boolValue(false)); | 964 _assertLogicalAnd(_boolValue(false), _boolValue(false), _boolValue(false)); |
| 961 } | 965 } |
| 962 | 966 |
| 963 void test_logicalAnd_false_null() { | 967 void test_logicalAnd_false_null() { |
| 964 try { | 968 expect(() { |
| 965 _assertLogicalAnd(_boolValue(false), _boolValue(false), _nullValue()); | 969 _assertLogicalAnd(_boolValue(false), _boolValue(false), _nullValue()); |
| 966 fail("Expected EvaluationException"); | 970 }, throwsEvaluationException); |
| 967 } on EvaluationException {} | |
| 968 } | 971 } |
| 969 | 972 |
| 970 void test_logicalAnd_false_string() { | 973 void test_logicalAnd_false_string() { |
| 971 try { | 974 expect(() { |
| 972 _assertLogicalAnd( | 975 _assertLogicalAnd( |
| 973 _boolValue(false), _boolValue(false), _stringValue("false")); | 976 _boolValue(false), _boolValue(false), _stringValue("false")); |
| 974 fail("Expected EvaluationException"); | 977 }, throwsEvaluationException); |
| 975 } on EvaluationException {} | |
| 976 } | 978 } |
| 977 | 979 |
| 978 void test_logicalAnd_false_true() { | 980 void test_logicalAnd_false_true() { |
| 979 _assertLogicalAnd(_boolValue(false), _boolValue(false), _boolValue(true)); | 981 _assertLogicalAnd(_boolValue(false), _boolValue(false), _boolValue(true)); |
| 980 } | 982 } |
| 981 | 983 |
| 982 void test_logicalAnd_null_false() { | 984 void test_logicalAnd_null_false() { |
| 983 try { | 985 expect(() { |
| 984 _assertLogicalAnd(_boolValue(false), _nullValue(), _boolValue(false)); | 986 _assertLogicalAnd(_boolValue(false), _nullValue(), _boolValue(false)); |
| 985 fail("Expected EvaluationException"); | 987 }, throwsEvaluationException); |
| 986 } on EvaluationException {} | |
| 987 } | 988 } |
| 988 | 989 |
| 989 void test_logicalAnd_null_true() { | 990 void test_logicalAnd_null_true() { |
| 990 try { | 991 expect(() { |
| 991 _assertLogicalAnd(_boolValue(false), _nullValue(), _boolValue(true)); | 992 _assertLogicalAnd(_boolValue(false), _nullValue(), _boolValue(true)); |
| 992 fail("Expected EvaluationException"); | 993 }, throwsEvaluationException); |
| 993 } on EvaluationException {} | |
| 994 } | 994 } |
| 995 | 995 |
| 996 void test_logicalAnd_string_false() { | 996 void test_logicalAnd_string_false() { |
| 997 try { | 997 expect(() { |
| 998 _assertLogicalAnd( | 998 _assertLogicalAnd( |
| 999 _boolValue(false), _stringValue("true"), _boolValue(false)); | 999 _boolValue(false), _stringValue("true"), _boolValue(false)); |
| 1000 fail("Expected EvaluationException"); | 1000 }, throwsEvaluationException); |
| 1001 } on EvaluationException {} | |
| 1002 } | 1001 } |
| 1003 | 1002 |
| 1004 void test_logicalAnd_string_true() { | 1003 void test_logicalAnd_string_true() { |
| 1005 try { | 1004 expect(() { |
| 1006 _assertLogicalAnd( | 1005 _assertLogicalAnd( |
| 1007 _boolValue(false), _stringValue("false"), _boolValue(true)); | 1006 _boolValue(false), _stringValue("false"), _boolValue(true)); |
| 1008 fail("Expected EvaluationException"); | 1007 }, throwsEvaluationException); |
| 1009 } on EvaluationException {} | |
| 1010 } | 1008 } |
| 1011 | 1009 |
| 1012 void test_logicalAnd_true_false() { | 1010 void test_logicalAnd_true_false() { |
| 1013 _assertLogicalAnd(_boolValue(false), _boolValue(true), _boolValue(false)); | 1011 _assertLogicalAnd(_boolValue(false), _boolValue(true), _boolValue(false)); |
| 1014 } | 1012 } |
| 1015 | 1013 |
| 1016 void test_logicalAnd_true_null() { | 1014 void test_logicalAnd_true_null() { |
| 1017 _assertLogicalAnd(null, _boolValue(true), _nullValue()); | 1015 _assertLogicalAnd(null, _boolValue(true), _nullValue()); |
| 1018 } | 1016 } |
| 1019 | 1017 |
| 1020 void test_logicalAnd_true_string() { | 1018 void test_logicalAnd_true_string() { |
| 1021 try { | 1019 expect(() { |
| 1022 _assertLogicalAnd( | 1020 _assertLogicalAnd( |
| 1023 _boolValue(false), _boolValue(true), _stringValue("true")); | 1021 _boolValue(false), _boolValue(true), _stringValue("true")); |
| 1024 fail("Expected EvaluationException"); | 1022 }, throwsEvaluationException); |
| 1025 } on EvaluationException {} | |
| 1026 } | 1023 } |
| 1027 | 1024 |
| 1028 void test_logicalAnd_true_true() { | 1025 void test_logicalAnd_true_true() { |
| 1029 _assertLogicalAnd(_boolValue(true), _boolValue(true), _boolValue(true)); | 1026 _assertLogicalAnd(_boolValue(true), _boolValue(true), _boolValue(true)); |
| 1030 } | 1027 } |
| 1031 | 1028 |
| 1032 void test_logicalNot_false() { | 1029 void test_logicalNot_false() { |
| 1033 _assertLogicalNot(_boolValue(true), _boolValue(false)); | 1030 _assertLogicalNot(_boolValue(true), _boolValue(false)); |
| 1034 } | 1031 } |
| 1035 | 1032 |
| 1036 void test_logicalNot_null() { | 1033 void test_logicalNot_null() { |
| 1037 _assertLogicalNot(null, _nullValue()); | 1034 _assertLogicalNot(null, _nullValue()); |
| 1038 } | 1035 } |
| 1039 | 1036 |
| 1040 void test_logicalNot_string() { | 1037 void test_logicalNot_string() { |
| 1041 try { | 1038 expect(() { |
| 1042 _assertLogicalNot(_boolValue(true), _stringValue(null)); | 1039 _assertLogicalNot(_boolValue(true), _stringValue(null)); |
| 1043 fail("Expected EvaluationException"); | 1040 }, throwsEvaluationException); |
| 1044 } on EvaluationException {} | |
| 1045 } | 1041 } |
| 1046 | 1042 |
| 1047 void test_logicalNot_true() { | 1043 void test_logicalNot_true() { |
| 1048 _assertLogicalNot(_boolValue(false), _boolValue(true)); | 1044 _assertLogicalNot(_boolValue(false), _boolValue(true)); |
| 1049 } | 1045 } |
| 1050 | 1046 |
| 1051 void test_logicalNot_unknown() { | 1047 void test_logicalNot_unknown() { |
| 1052 _assertLogicalNot(_boolValue(null), _boolValue(null)); | 1048 _assertLogicalNot(_boolValue(null), _boolValue(null)); |
| 1053 } | 1049 } |
| 1054 | 1050 |
| 1055 void test_logicalOr_false_false() { | 1051 void test_logicalOr_false_false() { |
| 1056 _assertLogicalOr(_boolValue(false), _boolValue(false), _boolValue(false)); | 1052 _assertLogicalOr(_boolValue(false), _boolValue(false), _boolValue(false)); |
| 1057 } | 1053 } |
| 1058 | 1054 |
| 1059 void test_logicalOr_false_null() { | 1055 void test_logicalOr_false_null() { |
| 1060 _assertLogicalOr(null, _boolValue(false), _nullValue()); | 1056 _assertLogicalOr(null, _boolValue(false), _nullValue()); |
| 1061 } | 1057 } |
| 1062 | 1058 |
| 1063 void test_logicalOr_false_string() { | 1059 void test_logicalOr_false_string() { |
| 1064 try { | 1060 expect(() { |
| 1065 _assertLogicalOr( | 1061 _assertLogicalOr( |
| 1066 _boolValue(false), _boolValue(false), _stringValue("false")); | 1062 _boolValue(false), _boolValue(false), _stringValue("false")); |
| 1067 fail("Expected EvaluationException"); | 1063 }, throwsEvaluationException); |
| 1068 } on EvaluationException {} | |
| 1069 } | 1064 } |
| 1070 | 1065 |
| 1071 void test_logicalOr_false_true() { | 1066 void test_logicalOr_false_true() { |
| 1072 _assertLogicalOr(_boolValue(true), _boolValue(false), _boolValue(true)); | 1067 _assertLogicalOr(_boolValue(true), _boolValue(false), _boolValue(true)); |
| 1073 } | 1068 } |
| 1074 | 1069 |
| 1075 void test_logicalOr_null_false() { | 1070 void test_logicalOr_null_false() { |
| 1076 try { | 1071 expect(() { |
| 1077 _assertLogicalOr(_boolValue(false), _nullValue(), _boolValue(false)); | 1072 _assertLogicalOr(_boolValue(false), _nullValue(), _boolValue(false)); |
| 1078 fail("Expected EvaluationException"); | 1073 }, throwsEvaluationException); |
| 1079 } on EvaluationException {} | |
| 1080 } | 1074 } |
| 1081 | 1075 |
| 1082 void test_logicalOr_null_true() { | 1076 void test_logicalOr_null_true() { |
| 1083 try { | 1077 expect(() { |
| 1084 _assertLogicalOr(_boolValue(true), _nullValue(), _boolValue(true)); | 1078 _assertLogicalOr(_boolValue(true), _nullValue(), _boolValue(true)); |
| 1085 fail("Expected EvaluationException"); | 1079 }, throwsEvaluationException); |
| 1086 } on EvaluationException {} | |
| 1087 } | 1080 } |
| 1088 | 1081 |
| 1089 void test_logicalOr_string_false() { | 1082 void test_logicalOr_string_false() { |
| 1090 try { | 1083 expect(() { |
| 1091 _assertLogicalOr( | 1084 _assertLogicalOr( |
| 1092 _boolValue(false), _stringValue("true"), _boolValue(false)); | 1085 _boolValue(false), _stringValue("true"), _boolValue(false)); |
| 1093 fail("Expected EvaluationException"); | 1086 }, throwsEvaluationException); |
| 1094 } on EvaluationException {} | |
| 1095 } | 1087 } |
| 1096 | 1088 |
| 1097 void test_logicalOr_string_true() { | 1089 void test_logicalOr_string_true() { |
| 1098 try { | 1090 expect(() { |
| 1099 _assertLogicalOr( | 1091 _assertLogicalOr( |
| 1100 _boolValue(true), _stringValue("false"), _boolValue(true)); | 1092 _boolValue(true), _stringValue("false"), _boolValue(true)); |
| 1101 fail("Expected EvaluationException"); | 1093 }, throwsEvaluationException); |
| 1102 } on EvaluationException {} | |
| 1103 } | 1094 } |
| 1104 | 1095 |
| 1105 void test_logicalOr_true_false() { | 1096 void test_logicalOr_true_false() { |
| 1106 _assertLogicalOr(_boolValue(true), _boolValue(true), _boolValue(false)); | 1097 _assertLogicalOr(_boolValue(true), _boolValue(true), _boolValue(false)); |
| 1107 } | 1098 } |
| 1108 | 1099 |
| 1109 void test_logicalOr_true_null() { | 1100 void test_logicalOr_true_null() { |
| 1110 try { | 1101 expect(() { |
| 1111 _assertLogicalOr(_boolValue(true), _boolValue(true), _nullValue()); | 1102 _assertLogicalOr(_boolValue(true), _boolValue(true), _nullValue()); |
| 1112 fail("Expected EvaluationException"); | 1103 }, throwsEvaluationException); |
| 1113 } on EvaluationException {} | |
| 1114 } | 1104 } |
| 1115 | 1105 |
| 1116 void test_logicalOr_true_string() { | 1106 void test_logicalOr_true_string() { |
| 1117 try { | 1107 expect(() { |
| 1118 _assertLogicalOr( | 1108 _assertLogicalOr( |
| 1119 _boolValue(true), _boolValue(true), _stringValue("true")); | 1109 _boolValue(true), _boolValue(true), _stringValue("true")); |
| 1120 fail("Expected EvaluationException"); | 1110 }, throwsEvaluationException); |
| 1121 } on EvaluationException {} | |
| 1122 } | 1111 } |
| 1123 | 1112 |
| 1124 void test_logicalOr_true_true() { | 1113 void test_logicalOr_true_true() { |
| 1125 _assertLogicalOr(_boolValue(true), _boolValue(true), _boolValue(true)); | 1114 _assertLogicalOr(_boolValue(true), _boolValue(true), _boolValue(true)); |
| 1126 } | 1115 } |
| 1127 | 1116 |
| 1128 void test_minus_knownDouble_knownDouble() { | 1117 void test_minus_knownDouble_knownDouble() { |
| 1129 _assertMinus(_doubleValue(1.0), _doubleValue(4.0), _doubleValue(3.0)); | 1118 _assertMinus(_doubleValue(1.0), _doubleValue(4.0), _doubleValue(3.0)); |
| 1130 } | 1119 } |
| 1131 | 1120 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 | 1389 |
| 1401 void test_shiftRight_unknownInt_knownInt() { | 1390 void test_shiftRight_unknownInt_knownInt() { |
| 1402 _assertShiftRight(_intValue(null), _intValue(null), _intValue(3)); | 1391 _assertShiftRight(_intValue(null), _intValue(null), _intValue(3)); |
| 1403 } | 1392 } |
| 1404 | 1393 |
| 1405 void test_shiftRight_unknownInt_unknownInt() { | 1394 void test_shiftRight_unknownInt_unknownInt() { |
| 1406 _assertShiftRight(_intValue(null), _intValue(null), _intValue(null)); | 1395 _assertShiftRight(_intValue(null), _intValue(null), _intValue(null)); |
| 1407 } | 1396 } |
| 1408 | 1397 |
| 1409 void test_stringLength_int() { | 1398 void test_stringLength_int() { |
| 1410 try { | 1399 expect(() { |
| 1411 _assertStringLength(_intValue(null), _intValue(0)); | 1400 _assertStringLength(_intValue(null), _intValue(0)); |
| 1412 fail("Expected EvaluationException"); | 1401 }, throwsEvaluationException); |
| 1413 } on EvaluationException {} | |
| 1414 } | 1402 } |
| 1415 | 1403 |
| 1416 void test_stringLength_knownString() { | 1404 void test_stringLength_knownString() { |
| 1417 _assertStringLength(_intValue(3), _stringValue("abc")); | 1405 _assertStringLength(_intValue(3), _stringValue("abc")); |
| 1418 } | 1406 } |
| 1419 | 1407 |
| 1420 void test_stringLength_unknownString() { | 1408 void test_stringLength_unknownString() { |
| 1421 _assertStringLength(_intValue(null), _stringValue(null)); | 1409 _assertStringLength(_intValue(null), _stringValue(null)); |
| 1422 } | 1410 } |
| 1423 | 1411 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1474 } | 1462 } |
| 1475 | 1463 |
| 1476 /** | 1464 /** |
| 1477 * Assert that the result of adding the [left] and [right] operands is the | 1465 * Assert that the result of adding the [left] and [right] operands is the |
| 1478 * [expected] value, or that the operation throws an exception if the expected | 1466 * [expected] value, or that the operation throws an exception if the expected |
| 1479 * value is `null`. | 1467 * value is `null`. |
| 1480 */ | 1468 */ |
| 1481 void _assertAdd( | 1469 void _assertAdd( |
| 1482 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1470 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1483 if (expected == null) { | 1471 if (expected == null) { |
| 1484 try { | 1472 expect(() { |
| 1485 left.add(_typeProvider, right); | 1473 left.add(_typeProvider, right); |
| 1486 fail("Expected an EvaluationException"); | 1474 }, throwsEvaluationException); |
| 1487 } on EvaluationException {} | |
| 1488 } else { | 1475 } else { |
| 1489 DartObjectImpl result = left.add(_typeProvider, right); | 1476 DartObjectImpl result = left.add(_typeProvider, right); |
| 1490 expect(result, isNotNull); | 1477 expect(result, isNotNull); |
| 1491 expect(result, expected); | 1478 expect(result, expected); |
| 1492 } | 1479 } |
| 1493 } | 1480 } |
| 1494 | 1481 |
| 1495 /** | 1482 /** |
| 1496 * Assert that the result of bit-anding the [left] and [right] operands is the | 1483 * Assert that the result of bit-anding the [left] and [right] operands is the |
| 1497 * [expected] value, or that the operation throws an exception if the expected | 1484 * [expected] value, or that the operation throws an exception if the expected |
| 1498 * value is `null`. | 1485 * value is `null`. |
| 1499 */ | 1486 */ |
| 1500 void _assertBitAnd( | 1487 void _assertBitAnd( |
| 1501 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1488 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1502 if (expected == null) { | 1489 if (expected == null) { |
| 1503 try { | 1490 expect(() { |
| 1504 left.bitAnd(_typeProvider, right); | 1491 left.bitAnd(_typeProvider, right); |
| 1505 fail("Expected an EvaluationException"); | 1492 }, throwsEvaluationException); |
| 1506 } on EvaluationException {} | |
| 1507 } else { | 1493 } else { |
| 1508 DartObjectImpl result = left.bitAnd(_typeProvider, right); | 1494 DartObjectImpl result = left.bitAnd(_typeProvider, right); |
| 1509 expect(result, isNotNull); | 1495 expect(result, isNotNull); |
| 1510 expect(result, expected); | 1496 expect(result, expected); |
| 1511 } | 1497 } |
| 1512 } | 1498 } |
| 1513 | 1499 |
| 1514 /** | 1500 /** |
| 1515 * Assert that the bit-not of the [operand] is the [expected] value, or that | 1501 * Assert that the bit-not of the [operand] is the [expected] value, or that |
| 1516 * the operation throws an exception if the expected value is `null`. | 1502 * the operation throws an exception if the expected value is `null`. |
| 1517 */ | 1503 */ |
| 1518 void _assertBitNot(DartObjectImpl expected, DartObjectImpl operand) { | 1504 void _assertBitNot(DartObjectImpl expected, DartObjectImpl operand) { |
| 1519 if (expected == null) { | 1505 if (expected == null) { |
| 1520 try { | 1506 expect(() { |
| 1521 operand.bitNot(_typeProvider); | 1507 operand.bitNot(_typeProvider); |
| 1522 fail("Expected an EvaluationException"); | 1508 }, throwsEvaluationException); |
| 1523 } on EvaluationException {} | |
| 1524 } else { | 1509 } else { |
| 1525 DartObjectImpl result = operand.bitNot(_typeProvider); | 1510 DartObjectImpl result = operand.bitNot(_typeProvider); |
| 1526 expect(result, isNotNull); | 1511 expect(result, isNotNull); |
| 1527 expect(result, expected); | 1512 expect(result, expected); |
| 1528 } | 1513 } |
| 1529 } | 1514 } |
| 1530 | 1515 |
| 1531 /** | 1516 /** |
| 1532 * Assert that the result of bit-oring the [left] and [right] operands is the | 1517 * Assert that the result of bit-oring the [left] and [right] operands is the |
| 1533 * [expected] value, or that the operation throws an exception if the expected | 1518 * [expected] value, or that the operation throws an exception if the expected |
| 1534 * value is `null`. | 1519 * value is `null`. |
| 1535 */ | 1520 */ |
| 1536 void _assertBitOr( | 1521 void _assertBitOr( |
| 1537 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1522 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1538 if (expected == null) { | 1523 if (expected == null) { |
| 1539 try { | 1524 expect(() { |
| 1540 left.bitOr(_typeProvider, right); | 1525 left.bitOr(_typeProvider, right); |
| 1541 fail("Expected an EvaluationException"); | 1526 }, throwsEvaluationException); |
| 1542 } on EvaluationException {} | |
| 1543 } else { | 1527 } else { |
| 1544 DartObjectImpl result = left.bitOr(_typeProvider, right); | 1528 DartObjectImpl result = left.bitOr(_typeProvider, right); |
| 1545 expect(result, isNotNull); | 1529 expect(result, isNotNull); |
| 1546 expect(result, expected); | 1530 expect(result, expected); |
| 1547 } | 1531 } |
| 1548 } | 1532 } |
| 1549 | 1533 |
| 1550 /** | 1534 /** |
| 1551 * Assert that the result of bit-xoring the [left] and [right] operands is the | 1535 * Assert that the result of bit-xoring the [left] and [right] operands is the |
| 1552 * [expected] value, or that the operation throws an exception if the expected | 1536 * [expected] value, or that the operation throws an exception if the expected |
| 1553 * value is `null`. | 1537 * value is `null`. |
| 1554 */ | 1538 */ |
| 1555 void _assertBitXor( | 1539 void _assertBitXor( |
| 1556 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1540 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1557 if (expected == null) { | 1541 if (expected == null) { |
| 1558 try { | 1542 expect(() { |
| 1559 left.bitXor(_typeProvider, right); | 1543 left.bitXor(_typeProvider, right); |
| 1560 fail("Expected an EvaluationException"); | 1544 }, throwsEvaluationException); |
| 1561 } on EvaluationException {} | |
| 1562 } else { | 1545 } else { |
| 1563 DartObjectImpl result = left.bitXor(_typeProvider, right); | 1546 DartObjectImpl result = left.bitXor(_typeProvider, right); |
| 1564 expect(result, isNotNull); | 1547 expect(result, isNotNull); |
| 1565 expect(result, expected); | 1548 expect(result, expected); |
| 1566 } | 1549 } |
| 1567 } | 1550 } |
| 1568 | 1551 |
| 1569 /** | 1552 /** |
| 1570 * Assert that the result of concatenating the [left] and [right] operands is | 1553 * Assert that the result of concatenating the [left] and [right] operands is |
| 1571 * the [expected] value, or that the operation throws an exception if the | 1554 * the [expected] value, or that the operation throws an exception if the |
| 1572 * expected value is `null`. | 1555 * expected value is `null`. |
| 1573 */ | 1556 */ |
| 1574 void _assertConcatenate( | 1557 void _assertConcatenate( |
| 1575 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1558 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1576 if (expected == null) { | 1559 if (expected == null) { |
| 1577 try { | 1560 expect(() { |
| 1578 left.concatenate(_typeProvider, right); | 1561 left.concatenate(_typeProvider, right); |
| 1579 fail("Expected an EvaluationException"); | 1562 }, throwsEvaluationException); |
| 1580 } on EvaluationException {} | |
| 1581 } else { | 1563 } else { |
| 1582 DartObjectImpl result = left.concatenate(_typeProvider, right); | 1564 DartObjectImpl result = left.concatenate(_typeProvider, right); |
| 1583 expect(result, isNotNull); | 1565 expect(result, isNotNull); |
| 1584 expect(result, expected); | 1566 expect(result, expected); |
| 1585 } | 1567 } |
| 1586 } | 1568 } |
| 1587 | 1569 |
| 1588 /** | 1570 /** |
| 1589 * Assert that the result of dividing the [left] and [right] operands is the | 1571 * Assert that the result of dividing the [left] and [right] operands is the |
| 1590 * [expected] value, or that the operation throws an exception if the expected | 1572 * [expected] value, or that the operation throws an exception if the expected |
| 1591 * value is `null`. | 1573 * value is `null`. |
| 1592 */ | 1574 */ |
| 1593 void _assertDivide( | 1575 void _assertDivide( |
| 1594 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1576 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1595 if (expected == null) { | 1577 if (expected == null) { |
| 1596 try { | 1578 expect(() { |
| 1597 left.divide(_typeProvider, right); | 1579 left.divide(_typeProvider, right); |
| 1598 fail("Expected an EvaluationException"); | 1580 }, throwsEvaluationException); |
| 1599 } on EvaluationException {} | |
| 1600 } else { | 1581 } else { |
| 1601 DartObjectImpl result = left.divide(_typeProvider, right); | 1582 DartObjectImpl result = left.divide(_typeProvider, right); |
| 1602 expect(result, isNotNull); | 1583 expect(result, isNotNull); |
| 1603 expect(result, expected); | 1584 expect(result, expected); |
| 1604 } | 1585 } |
| 1605 } | 1586 } |
| 1606 | 1587 |
| 1607 /** | 1588 /** |
| 1608 * Assert that the result of comparing the [left] and [right] operands for | 1589 * Assert that the result of comparing the [left] and [right] operands for |
| 1609 * equality is the [expected] value, or that the operation throws an exception | 1590 * equality is the [expected] value, or that the operation throws an exception |
| 1610 * if the expected value is `null`. | 1591 * if the expected value is `null`. |
| 1611 */ | 1592 */ |
| 1612 void _assertEqualEqual( | 1593 void _assertEqualEqual( |
| 1613 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1594 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1614 if (expected == null) { | 1595 if (expected == null) { |
| 1615 try { | 1596 expect(() { |
| 1616 left.equalEqual(_typeProvider, right); | 1597 left.equalEqual(_typeProvider, right); |
| 1617 fail("Expected an EvaluationException"); | 1598 }, throwsEvaluationException); |
| 1618 } on EvaluationException {} | |
| 1619 } else { | 1599 } else { |
| 1620 DartObjectImpl result = left.equalEqual(_typeProvider, right); | 1600 DartObjectImpl result = left.equalEqual(_typeProvider, right); |
| 1621 expect(result, isNotNull); | 1601 expect(result, isNotNull); |
| 1622 expect(result, expected); | 1602 expect(result, expected); |
| 1623 } | 1603 } |
| 1624 } | 1604 } |
| 1625 | 1605 |
| 1626 /** | 1606 /** |
| 1627 * Assert that the result of comparing the [left] and [right] operands is the | 1607 * Assert that the result of comparing the [left] and [right] operands is the |
| 1628 * [expected] value, or that the operation throws an exception if the expected | 1608 * [expected] value, or that the operation throws an exception if the expected |
| 1629 * value is `null`. | 1609 * value is `null`. |
| 1630 */ | 1610 */ |
| 1631 void _assertGreaterThan( | 1611 void _assertGreaterThan( |
| 1632 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1612 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1633 if (expected == null) { | 1613 if (expected == null) { |
| 1634 try { | 1614 expect(() { |
| 1635 left.greaterThan(_typeProvider, right); | 1615 left.greaterThan(_typeProvider, right); |
| 1636 fail("Expected an EvaluationException"); | 1616 }, throwsEvaluationException); |
| 1637 } on EvaluationException {} | |
| 1638 } else { | 1617 } else { |
| 1639 DartObjectImpl result = left.greaterThan(_typeProvider, right); | 1618 DartObjectImpl result = left.greaterThan(_typeProvider, right); |
| 1640 expect(result, isNotNull); | 1619 expect(result, isNotNull); |
| 1641 expect(result, expected); | 1620 expect(result, expected); |
| 1642 } | 1621 } |
| 1643 } | 1622 } |
| 1644 | 1623 |
| 1645 /** | 1624 /** |
| 1646 * Assert that the result of comparing the [left] and [right] operands is the | 1625 * Assert that the result of comparing the [left] and [right] operands is the |
| 1647 * [expected] value, or that the operation throws an exception if the expected | 1626 * [expected] value, or that the operation throws an exception if the expected |
| 1648 * value is `null`. | 1627 * value is `null`. |
| 1649 */ | 1628 */ |
| 1650 void _assertGreaterThanOrEqual( | 1629 void _assertGreaterThanOrEqual( |
| 1651 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1630 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1652 if (expected == null) { | 1631 if (expected == null) { |
| 1653 try { | 1632 expect(() { |
| 1654 left.greaterThanOrEqual(_typeProvider, right); | 1633 left.greaterThanOrEqual(_typeProvider, right); |
| 1655 fail("Expected an EvaluationException"); | 1634 }, throwsEvaluationException); |
| 1656 } on EvaluationException {} | |
| 1657 } else { | 1635 } else { |
| 1658 DartObjectImpl result = left.greaterThanOrEqual(_typeProvider, right); | 1636 DartObjectImpl result = left.greaterThanOrEqual(_typeProvider, right); |
| 1659 expect(result, isNotNull); | 1637 expect(result, isNotNull); |
| 1660 expect(result, expected); | 1638 expect(result, expected); |
| 1661 } | 1639 } |
| 1662 } | 1640 } |
| 1663 | 1641 |
| 1664 /** | 1642 /** |
| 1665 * Assert that the result of comparing the [left] and [right] operands using | 1643 * Assert that the result of comparing the [left] and [right] operands using |
| 1666 * identical() is the expected value. | 1644 * identical() is the expected value. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1677 } | 1655 } |
| 1678 | 1656 |
| 1679 /** | 1657 /** |
| 1680 * Assert that the result of dividing the [left] and [right] operands as | 1658 * Assert that the result of dividing the [left] and [right] operands as |
| 1681 * integers is the [expected] value, or that the operation throws an exception | 1659 * integers is the [expected] value, or that the operation throws an exception |
| 1682 * if the expected value is `null`. | 1660 * if the expected value is `null`. |
| 1683 */ | 1661 */ |
| 1684 void _assertIntegerDivide( | 1662 void _assertIntegerDivide( |
| 1685 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1663 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1686 if (expected == null) { | 1664 if (expected == null) { |
| 1687 try { | 1665 expect(() { |
| 1688 left.integerDivide(_typeProvider, right); | 1666 left.integerDivide(_typeProvider, right); |
| 1689 fail("Expected an EvaluationException"); | 1667 }, throwsEvaluationException); |
| 1690 } on EvaluationException {} | |
| 1691 } else { | 1668 } else { |
| 1692 DartObjectImpl result = left.integerDivide(_typeProvider, right); | 1669 DartObjectImpl result = left.integerDivide(_typeProvider, right); |
| 1693 expect(result, isNotNull); | 1670 expect(result, isNotNull); |
| 1694 expect(result, expected); | 1671 expect(result, expected); |
| 1695 } | 1672 } |
| 1696 } | 1673 } |
| 1697 | 1674 |
| 1698 /** | 1675 /** |
| 1699 * Assert that the result of comparing the [left] and [right] operands is the | 1676 * Assert that the result of comparing the [left] and [right] operands is the |
| 1700 * [expected] value, or that the operation throws an exception if the expected | 1677 * [expected] value, or that the operation throws an exception if the expected |
| 1701 * value is `null`. | 1678 * value is `null`. |
| 1702 */ | 1679 */ |
| 1703 void _assertLessThan( | 1680 void _assertLessThan( |
| 1704 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1681 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1705 if (expected == null) { | 1682 if (expected == null) { |
| 1706 try { | 1683 expect(() { |
| 1707 left.lessThan(_typeProvider, right); | 1684 left.lessThan(_typeProvider, right); |
| 1708 fail("Expected an EvaluationException"); | 1685 }, throwsEvaluationException); |
| 1709 } on EvaluationException {} | |
| 1710 } else { | 1686 } else { |
| 1711 DartObjectImpl result = left.lessThan(_typeProvider, right); | 1687 DartObjectImpl result = left.lessThan(_typeProvider, right); |
| 1712 expect(result, isNotNull); | 1688 expect(result, isNotNull); |
| 1713 expect(result, expected); | 1689 expect(result, expected); |
| 1714 } | 1690 } |
| 1715 } | 1691 } |
| 1716 | 1692 |
| 1717 /** | 1693 /** |
| 1718 * Assert that the result of comparing the [left] and [right] operands is the | 1694 * Assert that the result of comparing the [left] and [right] operands is the |
| 1719 * [expected] value, or that the operation throws an exception if the expected | 1695 * [expected] value, or that the operation throws an exception if the expected |
| 1720 * value is `null`. | 1696 * value is `null`. |
| 1721 */ | 1697 */ |
| 1722 void _assertLessThanOrEqual( | 1698 void _assertLessThanOrEqual( |
| 1723 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1699 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1724 if (expected == null) { | 1700 if (expected == null) { |
| 1725 try { | 1701 expect(() { |
| 1726 left.lessThanOrEqual(_typeProvider, right); | 1702 left.lessThanOrEqual(_typeProvider, right); |
| 1727 fail("Expected an EvaluationException"); | 1703 }, throwsEvaluationException); |
| 1728 } on EvaluationException {} | |
| 1729 } else { | 1704 } else { |
| 1730 DartObjectImpl result = left.lessThanOrEqual(_typeProvider, right); | 1705 DartObjectImpl result = left.lessThanOrEqual(_typeProvider, right); |
| 1731 expect(result, isNotNull); | 1706 expect(result, isNotNull); |
| 1732 expect(result, expected); | 1707 expect(result, expected); |
| 1733 } | 1708 } |
| 1734 } | 1709 } |
| 1735 | 1710 |
| 1736 /** | 1711 /** |
| 1737 * Assert that the result of logical-anding the [left] and [right] operands is | 1712 * Assert that the result of logical-anding the [left] and [right] operands is |
| 1738 * the [expected] value, or that the operation throws an exception if the | 1713 * the [expected] value, or that the operation throws an exception if the |
| 1739 * expected value is `null`. | 1714 * expected value is `null`. |
| 1740 */ | 1715 */ |
| 1741 void _assertLogicalAnd( | 1716 void _assertLogicalAnd( |
| 1742 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1717 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1743 if (expected == null) { | 1718 if (expected == null) { |
| 1744 try { | 1719 expect(() { |
| 1745 left.logicalAnd(_typeProvider, right); | 1720 left.logicalAnd(_typeProvider, right); |
| 1746 fail("Expected an EvaluationException"); | 1721 }, throwsEvaluationException); |
| 1747 } on EvaluationException {} | |
| 1748 } else { | 1722 } else { |
| 1749 DartObjectImpl result = left.logicalAnd(_typeProvider, right); | 1723 DartObjectImpl result = left.logicalAnd(_typeProvider, right); |
| 1750 expect(result, isNotNull); | 1724 expect(result, isNotNull); |
| 1751 expect(result, expected); | 1725 expect(result, expected); |
| 1752 } | 1726 } |
| 1753 } | 1727 } |
| 1754 | 1728 |
| 1755 /** | 1729 /** |
| 1756 * Assert that the logical-not of the [operand] is the [expected] value, or | 1730 * Assert that the logical-not of the [operand] is the [expected] value, or |
| 1757 * that the operation throws an exception if the expected value is `null`. | 1731 * that the operation throws an exception if the expected value is `null`. |
| 1758 */ | 1732 */ |
| 1759 void _assertLogicalNot(DartObjectImpl expected, DartObjectImpl operand) { | 1733 void _assertLogicalNot(DartObjectImpl expected, DartObjectImpl operand) { |
| 1760 if (expected == null) { | 1734 if (expected == null) { |
| 1761 try { | 1735 expect(() { |
| 1762 operand.logicalNot(_typeProvider); | 1736 operand.logicalNot(_typeProvider); |
| 1763 fail("Expected an EvaluationException"); | 1737 }, throwsEvaluationException); |
| 1764 } on EvaluationException {} | |
| 1765 } else { | 1738 } else { |
| 1766 DartObjectImpl result = operand.logicalNot(_typeProvider); | 1739 DartObjectImpl result = operand.logicalNot(_typeProvider); |
| 1767 expect(result, isNotNull); | 1740 expect(result, isNotNull); |
| 1768 expect(result, expected); | 1741 expect(result, expected); |
| 1769 } | 1742 } |
| 1770 } | 1743 } |
| 1771 | 1744 |
| 1772 /** | 1745 /** |
| 1773 * Assert that the result of logical-oring the [left] and [right] operands is | 1746 * Assert that the result of logical-oring the [left] and [right] operands is |
| 1774 * the [expected] value, or that the operation throws an exception if the | 1747 * the [expected] value, or that the operation throws an exception if the |
| 1775 * expected value is `null`. | 1748 * expected value is `null`. |
| 1776 */ | 1749 */ |
| 1777 void _assertLogicalOr( | 1750 void _assertLogicalOr( |
| 1778 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1751 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1779 if (expected == null) { | 1752 if (expected == null) { |
| 1780 try { | 1753 expect(() { |
| 1781 left.logicalOr(_typeProvider, right); | 1754 left.logicalOr(_typeProvider, right); |
| 1782 fail("Expected an EvaluationException"); | 1755 }, throwsEvaluationException); |
| 1783 } on EvaluationException {} | |
| 1784 } else { | 1756 } else { |
| 1785 DartObjectImpl result = left.logicalOr(_typeProvider, right); | 1757 DartObjectImpl result = left.logicalOr(_typeProvider, right); |
| 1786 expect(result, isNotNull); | 1758 expect(result, isNotNull); |
| 1787 expect(result, expected); | 1759 expect(result, expected); |
| 1788 } | 1760 } |
| 1789 } | 1761 } |
| 1790 | 1762 |
| 1791 /** | 1763 /** |
| 1792 * Assert that the result of subtracting the [left] and [right] operands is | 1764 * Assert that the result of subtracting the [left] and [right] operands is |
| 1793 * the [expected] value, or that the operation throws an exception if the | 1765 * the [expected] value, or that the operation throws an exception if the |
| 1794 * expected value is `null`. | 1766 * expected value is `null`. |
| 1795 */ | 1767 */ |
| 1796 void _assertMinus( | 1768 void _assertMinus( |
| 1797 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1769 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1798 if (expected == null) { | 1770 if (expected == null) { |
| 1799 try { | 1771 expect(() { |
| 1800 left.minus(_typeProvider, right); | 1772 left.minus(_typeProvider, right); |
| 1801 fail("Expected an EvaluationException"); | 1773 }, throwsEvaluationException); |
| 1802 } on EvaluationException {} | |
| 1803 } else { | 1774 } else { |
| 1804 DartObjectImpl result = left.minus(_typeProvider, right); | 1775 DartObjectImpl result = left.minus(_typeProvider, right); |
| 1805 expect(result, isNotNull); | 1776 expect(result, isNotNull); |
| 1806 expect(result, expected); | 1777 expect(result, expected); |
| 1807 } | 1778 } |
| 1808 } | 1779 } |
| 1809 | 1780 |
| 1810 /** | 1781 /** |
| 1811 * Assert that the negation of the [operand] is the [expected] value, or that | 1782 * Assert that the negation of the [operand] is the [expected] value, or that |
| 1812 * the operation throws an exception if the expected value is `null`. | 1783 * the operation throws an exception if the expected value is `null`. |
| 1813 */ | 1784 */ |
| 1814 void _assertNegated(DartObjectImpl expected, DartObjectImpl operand) { | 1785 void _assertNegated(DartObjectImpl expected, DartObjectImpl operand) { |
| 1815 if (expected == null) { | 1786 if (expected == null) { |
| 1816 try { | 1787 expect(() { |
| 1817 operand.negated(_typeProvider); | 1788 operand.negated(_typeProvider); |
| 1818 fail("Expected an EvaluationException"); | 1789 }, throwsEvaluationException); |
| 1819 } on EvaluationException {} | |
| 1820 } else { | 1790 } else { |
| 1821 DartObjectImpl result = operand.negated(_typeProvider); | 1791 DartObjectImpl result = operand.negated(_typeProvider); |
| 1822 expect(result, isNotNull); | 1792 expect(result, isNotNull); |
| 1823 expect(result, expected); | 1793 expect(result, expected); |
| 1824 } | 1794 } |
| 1825 } | 1795 } |
| 1826 | 1796 |
| 1827 /** | 1797 /** |
| 1828 * Assert that the result of comparing the [left] and [right] operands for | 1798 * Assert that the result of comparing the [left] and [right] operands for |
| 1829 * inequality is the [expected] value, or that the operation throws an | 1799 * inequality is the [expected] value, or that the operation throws an |
| 1830 * exception if the expected value is `null`. | 1800 * exception if the expected value is `null`. |
| 1831 */ | 1801 */ |
| 1832 void _assertNotEqual( | 1802 void _assertNotEqual( |
| 1833 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1803 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1834 if (expected == null) { | 1804 if (expected == null) { |
| 1835 try { | 1805 expect(() { |
| 1836 left.notEqual(_typeProvider, right); | 1806 left.notEqual(_typeProvider, right); |
| 1837 fail("Expected an EvaluationException"); | 1807 }, throwsEvaluationException); |
| 1838 } on EvaluationException {} | |
| 1839 } else { | 1808 } else { |
| 1840 DartObjectImpl result = left.notEqual(_typeProvider, right); | 1809 DartObjectImpl result = left.notEqual(_typeProvider, right); |
| 1841 expect(result, isNotNull); | 1810 expect(result, isNotNull); |
| 1842 expect(result, expected); | 1811 expect(result, expected); |
| 1843 } | 1812 } |
| 1844 } | 1813 } |
| 1845 | 1814 |
| 1846 /** | 1815 /** |
| 1847 * Assert that converting the [operand] to a string is the [expected] value, | 1816 * Assert that converting the [operand] to a string is the [expected] value, |
| 1848 * or that the operation throws an exception if the expected value is `null`. | 1817 * or that the operation throws an exception if the expected value is `null`. |
| 1849 */ | 1818 */ |
| 1850 void _assertPerformToString(DartObjectImpl expected, DartObjectImpl operand) { | 1819 void _assertPerformToString(DartObjectImpl expected, DartObjectImpl operand) { |
| 1851 if (expected == null) { | 1820 if (expected == null) { |
| 1852 try { | 1821 expect(() { |
| 1853 operand.performToString(_typeProvider); | 1822 operand.performToString(_typeProvider); |
| 1854 fail("Expected an EvaluationException"); | 1823 }, throwsEvaluationException); |
| 1855 } on EvaluationException {} | |
| 1856 } else { | 1824 } else { |
| 1857 DartObjectImpl result = operand.performToString(_typeProvider); | 1825 DartObjectImpl result = operand.performToString(_typeProvider); |
| 1858 expect(result, isNotNull); | 1826 expect(result, isNotNull); |
| 1859 expect(result, expected); | 1827 expect(result, expected); |
| 1860 } | 1828 } |
| 1861 } | 1829 } |
| 1862 | 1830 |
| 1863 /** | 1831 /** |
| 1864 * Assert that the result of taking the remainder of the [left] and [right] | 1832 * Assert that the result of taking the remainder of the [left] and [right] |
| 1865 * operands is the [expected] value, or that the operation throws an exception | 1833 * operands is the [expected] value, or that the operation throws an exception |
| 1866 * if the expected value is `null`. | 1834 * if the expected value is `null`. |
| 1867 */ | 1835 */ |
| 1868 void _assertRemainder( | 1836 void _assertRemainder( |
| 1869 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1837 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1870 if (expected == null) { | 1838 if (expected == null) { |
| 1871 try { | 1839 expect(() { |
| 1872 left.remainder(_typeProvider, right); | 1840 left.remainder(_typeProvider, right); |
| 1873 fail("Expected an EvaluationException"); | 1841 }, throwsEvaluationException); |
| 1874 } on EvaluationException {} | |
| 1875 } else { | 1842 } else { |
| 1876 DartObjectImpl result = left.remainder(_typeProvider, right); | 1843 DartObjectImpl result = left.remainder(_typeProvider, right); |
| 1877 expect(result, isNotNull); | 1844 expect(result, isNotNull); |
| 1878 expect(result, expected); | 1845 expect(result, expected); |
| 1879 } | 1846 } |
| 1880 } | 1847 } |
| 1881 | 1848 |
| 1882 /** | 1849 /** |
| 1883 * Assert that the result of multiplying the [left] and [right] operands is | 1850 * Assert that the result of multiplying the [left] and [right] operands is |
| 1884 * the [expected] value, or that the operation throws an exception if the | 1851 * the [expected] value, or that the operation throws an exception if the |
| 1885 * expected value is `null`. | 1852 * expected value is `null`. |
| 1886 */ | 1853 */ |
| 1887 void _assertShiftLeft( | 1854 void _assertShiftLeft( |
| 1888 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1855 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1889 if (expected == null) { | 1856 if (expected == null) { |
| 1890 try { | 1857 expect(() { |
| 1891 left.shiftLeft(_typeProvider, right); | 1858 left.shiftLeft(_typeProvider, right); |
| 1892 fail("Expected an EvaluationException"); | 1859 }, throwsEvaluationException); |
| 1893 } on EvaluationException {} | |
| 1894 } else { | 1860 } else { |
| 1895 DartObjectImpl result = left.shiftLeft(_typeProvider, right); | 1861 DartObjectImpl result = left.shiftLeft(_typeProvider, right); |
| 1896 expect(result, isNotNull); | 1862 expect(result, isNotNull); |
| 1897 expect(result, expected); | 1863 expect(result, expected); |
| 1898 } | 1864 } |
| 1899 } | 1865 } |
| 1900 | 1866 |
| 1901 /** | 1867 /** |
| 1902 * Assert that the result of multiplying the [left] and [right] operands is | 1868 * Assert that the result of multiplying the [left] and [right] operands is |
| 1903 * the [expected] value, or that the operation throws an exception if the | 1869 * the [expected] value, or that the operation throws an exception if the |
| 1904 * expected value is `null`. | 1870 * expected value is `null`. |
| 1905 */ | 1871 */ |
| 1906 void _assertShiftRight( | 1872 void _assertShiftRight( |
| 1907 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1873 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1908 if (expected == null) { | 1874 if (expected == null) { |
| 1909 try { | 1875 expect(() { |
| 1910 left.shiftRight(_typeProvider, right); | 1876 left.shiftRight(_typeProvider, right); |
| 1911 fail("Expected an EvaluationException"); | 1877 }, throwsEvaluationException); |
| 1912 } on EvaluationException {} | |
| 1913 } else { | 1878 } else { |
| 1914 DartObjectImpl result = left.shiftRight(_typeProvider, right); | 1879 DartObjectImpl result = left.shiftRight(_typeProvider, right); |
| 1915 expect(result, isNotNull); | 1880 expect(result, isNotNull); |
| 1916 expect(result, expected); | 1881 expect(result, expected); |
| 1917 } | 1882 } |
| 1918 } | 1883 } |
| 1919 | 1884 |
| 1920 /** | 1885 /** |
| 1921 * Assert that the length of the [operand] is the [expected] value, or that | 1886 * Assert that the length of the [operand] is the [expected] value, or that |
| 1922 * the operation throws an exception if the expected value is `null`. | 1887 * the operation throws an exception if the expected value is `null`. |
| 1923 */ | 1888 */ |
| 1924 void _assertStringLength(DartObjectImpl expected, DartObjectImpl operand) { | 1889 void _assertStringLength(DartObjectImpl expected, DartObjectImpl operand) { |
| 1925 if (expected == null) { | 1890 if (expected == null) { |
| 1926 try { | 1891 expect(() { |
| 1927 operand.stringLength(_typeProvider); | 1892 operand.stringLength(_typeProvider); |
| 1928 fail("Expected an EvaluationException"); | 1893 }, throwsEvaluationException); |
| 1929 } on EvaluationException {} | |
| 1930 } else { | 1894 } else { |
| 1931 DartObjectImpl result = operand.stringLength(_typeProvider); | 1895 DartObjectImpl result = operand.stringLength(_typeProvider); |
| 1932 expect(result, isNotNull); | 1896 expect(result, isNotNull); |
| 1933 expect(result, expected); | 1897 expect(result, expected); |
| 1934 } | 1898 } |
| 1935 } | 1899 } |
| 1936 | 1900 |
| 1937 /** | 1901 /** |
| 1938 * Assert that the result of multiplying the [left] and [right] operands is | 1902 * Assert that the result of multiplying the [left] and [right] operands is |
| 1939 * the [expected] value, or that the operation throws an exception if the | 1903 * the [expected] value, or that the operation throws an exception if the |
| 1940 * expected value is `null`. | 1904 * expected value is `null`. |
| 1941 */ | 1905 */ |
| 1942 void _assertTimes( | 1906 void _assertTimes( |
| 1943 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { | 1907 DartObjectImpl expected, DartObjectImpl left, DartObjectImpl right) { |
| 1944 if (expected == null) { | 1908 if (expected == null) { |
| 1945 try { | 1909 expect(() { |
| 1946 left.times(_typeProvider, right); | 1910 left.times(_typeProvider, right); |
| 1947 fail("Expected an EvaluationException"); | 1911 }, throwsEvaluationException); |
| 1948 } on EvaluationException {} | |
| 1949 } else { | 1912 } else { |
| 1950 DartObjectImpl result = left.times(_typeProvider, right); | 1913 DartObjectImpl result = left.times(_typeProvider, right); |
| 1951 expect(result, isNotNull); | 1914 expect(result, isNotNull); |
| 1952 expect(result, expected); | 1915 expect(result, expected); |
| 1953 } | 1916 } |
| 1954 } | 1917 } |
| 1955 | 1918 |
| 1956 DartObjectImpl _boolValue(bool value) { | 1919 DartObjectImpl _boolValue(bool value) { |
| 1957 if (value == null) { | 1920 if (value == null) { |
| 1958 return new DartObjectImpl( | 1921 return new DartObjectImpl( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 } else { | 1983 } else { |
| 2021 return new DartObjectImpl( | 1984 return new DartObjectImpl( |
| 2022 _typeProvider.stringType, new StringState(value)); | 1985 _typeProvider.stringType, new StringState(value)); |
| 2023 } | 1986 } |
| 2024 } | 1987 } |
| 2025 | 1988 |
| 2026 DartObjectImpl _symbolValue(String value) { | 1989 DartObjectImpl _symbolValue(String value) { |
| 2027 return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(value)); | 1990 return new DartObjectImpl(_typeProvider.symbolType, new SymbolState(value)); |
| 2028 } | 1991 } |
| 2029 } | 1992 } |
| OLD | NEW |