Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Unified Diff: pkg/analyzer/test/generated/all_the_rest.dart

Issue 689173004: Properly implement identical() test in analyzer constant evaluation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | tests/language/identical_const_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest.dart b/pkg/analyzer/test/generated/all_the_rest.dart
index 7aa42b018448f1b10780616dd8a4f189d9d14ff8..4e86f49e6e6c701bbc0ebd2fc94cc5cb1a27d505 100644
--- a/pkg/analyzer/test/generated/all_the_rest.dart
+++ b/pkg/analyzer/test/generated/all_the_rest.dart
@@ -5394,6 +5394,85 @@ class DartObjectImplTest extends EngineTestCase {
expect(_stringValue(null).hasExactValue, isTrue);
}
+ void test_identical_bool_false() {
+ _assertIdentical(_boolValue(false), _boolValue(false), _boolValue(true));
+ }
+
+ void test_identical_bool_true() {
+ _assertIdentical(_boolValue(true), _boolValue(true), _boolValue(true));
+ }
+
+ void test_identical_bool_unknown() {
+ _assertIdentical(_boolValue(null), _boolValue(null), _boolValue(false));
+ }
+
+ void test_identical_double_false() {
+ _assertIdentical(_boolValue(false), _doubleValue(2.0), _doubleValue(4.0));
+ }
+
+ void test_identical_double_true() {
+ _assertIdentical(_boolValue(true), _doubleValue(2.0), _doubleValue(2.0));
+ }
+
+ void test_identical_double_unknown() {
+ _assertIdentical(_boolValue(null), _doubleValue(1.0), _doubleValue(null));
+ }
+
+ void test_identical_int_false() {
+ _assertIdentical(_boolValue(false), _intValue(-5), _intValue(5));
+ }
+
+ void test_identical_int_true() {
+ _assertIdentical(_boolValue(true), _intValue(5), _intValue(5));
+ }
+
+ void test_identical_int_unknown() {
+ _assertIdentical(_boolValue(null), _intValue(null), _intValue(3));
+ }
+
+ void test_identical_list_empty() {
+ _assertIdentical(_boolValue(true), _listValue([]), _listValue([]));
+ }
+
+ void test_identical_list_false() {
+ _assertIdentical(_boolValue(false), _listValue([]),
+ _listValue([_intValue(3)]));
+ }
+
+ void test_identical_map_empty() {
+ _assertIdentical(_boolValue(true), _mapValue([]), _mapValue([]));
+ }
+
+ void test_identical_map_false() {
+ _assertIdentical(_boolValue(false), _mapValue([]),
+ _mapValue([_intValue(1), _intValue(2)]));
+ }
+
+ void test_identical_null() {
+ _assertIdentical(_boolValue(true), _nullValue(), _nullValue());
+ }
+
+ void test_identical_string_false() {
+ _assertIdentical(
+ _boolValue(false),
+ _stringValue("abc"),
+ _stringValue("def"));
+ }
+
+ void test_identical_string_true() {
+ _assertIdentical(
+ _boolValue(true),
+ _stringValue("abc"),
+ _stringValue("abc"));
+ }
+
+ void test_identical_string_unknown() {
+ _assertIdentical(
+ _boolValue(null),
+ _stringValue(null),
+ _stringValue("def"));
+ }
+
void test_integerDivide_knownDouble_knownDouble() {
_assertIntegerDivide(_intValue(3), _doubleValue(6.0), _doubleValue(2.0));
}
@@ -6441,6 +6520,22 @@ class DartObjectImplTest extends EngineTestCase {
}
}
+ /**
+ * Assert that the result of comparing the left and right operands using
+ * identical() is the expected value.
+ *
+ * @param expected the expected result of the operation
+ * @param leftOperand the left operand to the operation
+ * @param rightOperand the left operand to the operation
+ */
+ void _assertIdentical(DartObjectImpl expected, DartObjectImpl leftOperand,
+ DartObjectImpl rightOperand) {
+ DartObjectImpl result =
+ leftOperand.isIdentical(_typeProvider, rightOperand);
+ expect(result, isNotNull);
+ expect(result, expected);
+ }
+
void _assertInstanceOfObjectArray(Object result) {
// TODO(scheglov) implement
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/constant.dart ('k') | tests/language/identical_const_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698