Index: pkg/dev_compiler/test/codegen_expected/equality_test.js |
diff --git a/pkg/dev_compiler/test/codegen_expected/equality_test.js b/pkg/dev_compiler/test/codegen_expected/equality_test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..df50423905699bd8197fb206bbdea566012637ad |
--- /dev/null |
+++ b/pkg/dev_compiler/test/codegen_expected/equality_test.js |
@@ -0,0 +1,1141 @@ |
+define(['dart_sdk', 'expect'], function(dart_sdk, expect) { |
+ 'use strict'; |
+ const core = dart_sdk.core; |
+ const dart = dart_sdk.dart; |
+ const dartx = dart_sdk.dartx; |
+ const minitest = expect.minitest; |
+ const equality_test = Object.create(null); |
+ let TToT = () => (TToT = dart.constFn(dart.gFnType(T => [T, [T]])))(); |
+ let VoidToT = () => (VoidToT = dart.constFn(dart.gFnType(T => [T, []])))(); |
+ let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))(); |
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.fnType(dart.dynamic, [])))(); |
+ equality_test.Music = class Music extends core.Object { |
+ new(index) { |
+ this.index = index; |
+ } |
+ toString() { |
+ return { |
+ 0: "Music.country", |
+ 1: "Music.western" |
+ }[this.index]; |
+ } |
+ }; |
+ dart.setSignature(equality_test.Music, { |
+ fields: () => ({index: dart.finalFieldType(core.int)}) |
+ }); |
+ dart.defineEnumValues(equality_test.Music, [ |
+ 'country', |
+ 'western' |
+ ]); |
+ equality_test.BluesBrother = class BluesBrother extends core.Object {}; |
+ equality_test._Jake = class _Jake extends equality_test.BluesBrother {}; |
+ equality_test._Elwood = class _Elwood extends equality_test.BluesBrother { |
+ ['=='](other) { |
+ return equality_test._Elwood.is(other); |
+ } |
+ }; |
+ dart.setSignature(equality_test._Elwood, { |
+ methods: () => ({'==': dart.fnType(core.bool, [core.Object])}) |
+ }); |
+ equality_test._Norman = class _Norman extends equality_test.BluesBrother {}; |
+ equality_test.hideNull = function(T) { |
+ return x => { |
+ return x; |
+ }; |
+ }; |
+ dart.fn(equality_test.hideNull, TToT()); |
+ equality_test.getUndefined = function(T) { |
+ return () => { |
+ return T._check(core.List.new(1)[dartx._get](0)); |
+ }; |
+ }; |
+ dart.fn(equality_test.getUndefined, VoidToT()); |
+ equality_test.main = function() { |
+ minitest.group('Enum equality', dart.fn(() => { |
+ minitest.test('Equal enum/enum (nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(equality_test.Music)(equality_test.Music.country); |
+ let e2 = equality_test.hideNull(equality_test.Music)(equality_test.Music.western); |
+ let d1 = equality_test.hideNull(equality_test.Music)(equality_test.Music.country); |
+ let d2 = equality_test.hideNull(equality_test.Music)(equality_test.Music.western); |
+ let o1 = equality_test.hideNull(core.Object)(equality_test.Music.country); |
+ let o2 = equality_test.hideNull(core.Object)(equality_test.Music.western); |
+ minitest.expect(dart.equals(e1, e1), true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal enum/enum (non-null)', dart.fn(() => { |
+ let e1 = equality_test.Music.country; |
+ let e2 = equality_test.Music.western; |
+ let d1 = equality_test.Music.country; |
+ let d2 = equality_test.Music.western; |
+ let o1 = equality_test.Music.country; |
+ let o2 = equality_test.Music.western; |
+ minitest.expect(dart.equals(e1, e1), true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal enum/other (static, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(equality_test.Music)(equality_test.Music.country); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test.BluesBrother)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal enum/other (static, non-null)', dart.fn(() => { |
+ let e1 = equality_test.Music.country; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal enum/other (dynamic, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(equality_test.Music)(equality_test.Music.country); |
+ let d1 = equality_test.hideNull(equality_test.Music)(equality_test.Music.country); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test._Norman)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal enum/other (dynamic, non-null)', dart.fn(() => { |
+ let e1 = equality_test.Music.country; |
+ let d1 = equality_test.Music.country; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ minitest.group('String equality', dart.fn(() => { |
+ minitest.test('Equal string/string (nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.String)("The"); |
+ let e2 = equality_test.hideNull(core.String)("Band"); |
+ let d1 = equality_test.hideNull(core.String)("The"); |
+ let d2 = equality_test.hideNull(core.String)("Band"); |
+ let o1 = equality_test.hideNull(core.Object)("The"); |
+ let o2 = equality_test.hideNull(core.Object)("Band"); |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/string (non-null)', dart.fn(() => { |
+ let e1 = "The"; |
+ let e2 = "Band"; |
+ let d1 = "The"; |
+ let d2 = "Band"; |
+ let o1 = "The"; |
+ let o2 = "Band"; |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (static, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.String)("The"); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test.BluesBrother)(new equality_test._Norman()); |
+ minitest.expect(e1 == s1, false); |
+ minitest.expect(e1 == s2, false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(s1 == e1, false); |
+ minitest.expect(s2 == e1, false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (static, non-null)', dart.fn(() => { |
+ let e1 = "The"; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(e1 == s1, false); |
+ minitest.expect(e1 == s2, false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(s1 == e1, false); |
+ minitest.expect(s2 == e1, false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (dynamic, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.String)("The"); |
+ let d1 = equality_test.hideNull(core.String)("The"); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test._Norman)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (dynamic, non-null)', dart.fn(() => { |
+ let e1 = "The"; |
+ let d1 = "The"; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(e1 == s1, false); |
+ minitest.expect(e1 == s2, false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(s1 == e1, false); |
+ minitest.expect(s2 == e1, false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ minitest.group('Boolean equality', dart.fn(() => { |
+ minitest.test('Equal bool/bool (nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.bool)(true); |
+ let e2 = equality_test.hideNull(core.bool)(false); |
+ let d1 = equality_test.hideNull(core.bool)(true); |
+ let d2 = equality_test.hideNull(core.bool)(false); |
+ let o1 = equality_test.hideNull(core.Object)(true); |
+ let o2 = equality_test.hideNull(core.Object)(false); |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal bool/bool (non-null)', dart.fn(() => { |
+ let e1 = true; |
+ let e2 = false; |
+ let d1 = true; |
+ let d2 = false; |
+ let o1 = true; |
+ let o2 = false; |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal bool/other (static, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.bool)(true); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test.BluesBrother)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal bool/other (static, non-null)', dart.fn(() => { |
+ let e1 = true; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal bool/other (dynamic, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.bool)(true); |
+ let d1 = equality_test.hideNull(core.bool)(true); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test._Norman)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal bool/other (dynamic, non-null)', dart.fn(() => { |
+ let e1 = true; |
+ let d1 = true; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ minitest.group('String equality', dart.fn(() => { |
+ minitest.test('Equal string/string (nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.String)("The"); |
+ let e2 = equality_test.hideNull(core.String)("Band"); |
+ let d1 = equality_test.hideNull(core.String)("The"); |
+ let d2 = equality_test.hideNull(core.String)("Band"); |
+ let o1 = equality_test.hideNull(core.Object)("The"); |
+ let o2 = equality_test.hideNull(core.Object)("Band"); |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/string (non-null)', dart.fn(() => { |
+ let e1 = "The"; |
+ let e2 = "Band"; |
+ let d1 = "The"; |
+ let d2 = "Band"; |
+ let o1 = "The"; |
+ let o2 = "Band"; |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (static, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.String)("The"); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test.BluesBrother)(new equality_test._Norman()); |
+ minitest.expect(e1 == s1, false); |
+ minitest.expect(e1 == s2, false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(s1 == e1, false); |
+ minitest.expect(s2 == e1, false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (static, non-null)', dart.fn(() => { |
+ let e1 = "The"; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(e1 == s1, false); |
+ minitest.expect(e1 == s2, false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(s1 == e1, false); |
+ minitest.expect(s2 == e1, false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (dynamic, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.String)("The"); |
+ let d1 = equality_test.hideNull(core.String)("The"); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test._Norman)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal string/other (dynamic, non-null)', dart.fn(() => { |
+ let e1 = "The"; |
+ let d1 = "The"; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(e1 == s1, false); |
+ minitest.expect(e1 == s2, false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(s1 == e1, false); |
+ minitest.expect(s2 == e1, false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ minitest.group('Number equality', dart.fn(() => { |
+ minitest.test('Equal int/int (nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.int)(11); |
+ let e2 = equality_test.hideNull(core.int)(12); |
+ let d1 = equality_test.hideNull(core.int)(11); |
+ let d2 = equality_test.hideNull(core.int)(12); |
+ let o1 = equality_test.hideNull(core.Object)(11); |
+ let o2 = equality_test.hideNull(core.Object)(12); |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal int/int (non-null)', dart.fn(() => { |
+ let e1 = 11; |
+ let e2 = 12; |
+ let d1 = 11; |
+ let d2 = 12; |
+ let o1 = 11; |
+ let o2 = 12; |
+ minitest.expect(e1 == e1, true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(e1 == e2, false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal int/other (static, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.int)(11); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test.BluesBrother)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(e1 == i1, false); |
+ minitest.expect(e1 == i2, false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(i1 == e1, false); |
+ minitest.expect(i2 == e1, false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal int/other (static, non-null)', dart.fn(() => { |
+ let e1 = 11; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(e1 == i1, false); |
+ minitest.expect(e1 == i2, false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(i1 == e1, false); |
+ minitest.expect(i2 == e1, false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal int/other (dynamic, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(core.int)(11); |
+ let d1 = equality_test.hideNull(core.int)(11); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test._Norman)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal int/other (dynamic, non-null)', dart.fn(() => { |
+ let e1 = 11; |
+ let d1 = 11; |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(e1 == i1, false); |
+ minitest.expect(e1 == i2, false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(i1 == e1, false); |
+ minitest.expect(i2 == e1, false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ minitest.group('Object equality', dart.fn(() => { |
+ minitest.test('Equal object/object (nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(equality_test._Jake)(new equality_test._Jake()); |
+ let e2 = equality_test.hideNull(equality_test._Elwood)(new equality_test._Elwood()); |
+ let d1 = equality_test.hideNull(equality_test._Jake)(e1); |
+ let d2 = equality_test.hideNull(equality_test._Elwood)(new equality_test._Elwood()); |
+ let o1 = equality_test.hideNull(core.Object)(e1); |
+ let o2 = equality_test.hideNull(core.Object)(new equality_test._Elwood()); |
+ minitest.expect(dart.equals(e1, e1), true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal object/object (non-null)', dart.fn(() => { |
+ let e1 = new equality_test._Jake(); |
+ let e2 = new equality_test._Elwood(); |
+ let d1 = e1; |
+ let d2 = new equality_test._Elwood(); |
+ let o1 = e1; |
+ let o2 = new equality_test._Elwood(); |
+ minitest.expect(dart.equals(e1, e1), true); |
+ minitest.expect(dart.equals(e1, d1), true); |
+ minitest.expect(dart.equals(e1, o1), true); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(e1, o2), false); |
+ minitest.expect(dart.equals(e1, d2), false); |
+ minitest.expect(dart.equals(e1, e2), false); |
+ minitest.expect(dart.equals(d1, e1), true); |
+ minitest.expect(dart.equals(d1, d1), true); |
+ minitest.expect(dart.equals(d1, o1), true); |
+ minitest.expect(dart.equals(d1, e2), false); |
+ minitest.expect(dart.equals(d1, d2), false); |
+ minitest.expect(dart.equals(d1, o2), false); |
+ minitest.expect(dart.equals(o1, e1), true); |
+ minitest.expect(dart.equals(o1, d1), true); |
+ minitest.expect(dart.equals(o1, o1), true); |
+ minitest.expect(dart.equals(o1, e2), false); |
+ minitest.expect(dart.equals(o1, d2), false); |
+ minitest.expect(dart.equals(o1, o2), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal object/other (static, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(equality_test._Jake)(new equality_test._Jake()); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test.BluesBrother)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal object/other (static, non-null)', dart.fn(() => { |
+ let e1 = new equality_test._Jake(); |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal object/other (dynamic, nullable)', dart.fn(() => { |
+ let e1 = equality_test.hideNull(equality_test._Jake)(new equality_test._Jake()); |
+ let d1 = equality_test.hideNull(equality_test._Jake)(new equality_test._Jake()); |
+ let s1 = equality_test.hideNull(core.String)("hello"); |
+ let s2 = equality_test.hideNull(core.String)(""); |
+ let i1 = equality_test.hideNull(core.int)(3); |
+ let i2 = equality_test.hideNull(core.int)(0); |
+ let l1 = equality_test.hideNull(core.List)(core.List.new(3)); |
+ let b1 = equality_test.hideNull(equality_test._Norman)(new equality_test._Norman()); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ minitest.test('Equal object/other (dynamic, non-null)', dart.fn(() => { |
+ let e1 = new equality_test._Jake(); |
+ let d1 = new equality_test._Jake(); |
+ let s1 = "hello"; |
+ let s2 = ""; |
+ let i1 = 3; |
+ let i2 = 0; |
+ let l1 = core.List.new(3); |
+ let b1 = new equality_test._Norman(); |
+ minitest.expect(dart.equals(e1, s1), false); |
+ minitest.expect(dart.equals(e1, s2), false); |
+ minitest.expect(dart.equals(e1, i1), false); |
+ minitest.expect(dart.equals(e1, i2), false); |
+ minitest.expect(dart.equals(e1, l1), false); |
+ minitest.expect(dart.equals(e1, b1), false); |
+ minitest.expect(dart.equals(s1, e1), false); |
+ minitest.expect(dart.equals(s2, e1), false); |
+ minitest.expect(dart.equals(i1, e1), false); |
+ minitest.expect(dart.equals(i2, e1), false); |
+ minitest.expect(dart.equals(l1, e1), false); |
+ minitest.expect(dart.equals(b1, e1), false); |
+ minitest.expect(dart.equals(d1, s1), false); |
+ minitest.expect(dart.equals(d1, s2), false); |
+ minitest.expect(dart.equals(d1, i1), false); |
+ minitest.expect(dart.equals(d1, i2), false); |
+ minitest.expect(dart.equals(d1, l1), false); |
+ minitest.expect(dart.equals(d1, b1), false); |
+ minitest.expect(dart.equals(s1, d1), false); |
+ minitest.expect(dart.equals(s2, d1), false); |
+ minitest.expect(dart.equals(i1, d1), false); |
+ minitest.expect(dart.equals(i2, d1), false); |
+ minitest.expect(dart.equals(l1, d1), false); |
+ minitest.expect(dart.equals(b1, d1), false); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ minitest.group('Null/undefined equality', dart.fn(() => { |
+ minitest.test('Equal object/other (static, null)', dart.fn(() => { |
+ let n = equality_test.hideNull(equality_test.BluesBrother)(null); |
+ let u1 = equality_test.getUndefined(core.String)(); |
+ let u2 = equality_test.getUndefined(core.int)(); |
+ let u3 = equality_test.getUndefined(core.bool)(); |
+ let u4 = equality_test.getUndefined(core.List)(); |
+ minitest.expect(dart.equals(n, n), true); |
+ minitest.expect(dart.equals(n, u1), true); |
+ minitest.expect(dart.equals(n, u2), true); |
+ minitest.expect(dart.equals(n, u3), true); |
+ minitest.expect(dart.equals(n, u4), true); |
+ minitest.expect(dart.equals(u1, n), true); |
+ minitest.expect(dart.equals(u2, n), true); |
+ minitest.expect(dart.equals(u3, n), true); |
+ minitest.expect(dart.equals(u4, n), true); |
+ }, VoidToNull())); |
+ minitest.test('Equal String/other (static, null)', dart.fn(() => { |
+ let u1 = equality_test.getUndefined(equality_test.BluesBrother)(); |
+ let n = equality_test.hideNull(core.String)(null); |
+ let u2 = equality_test.getUndefined(core.int)(); |
+ let u3 = equality_test.getUndefined(core.bool)(); |
+ let u4 = equality_test.getUndefined(core.List)(); |
+ minitest.expect(n == n, true); |
+ minitest.expect(dart.equals(n, u1), true); |
+ minitest.expect(dart.equals(n, u2), true); |
+ minitest.expect(dart.equals(n, u3), true); |
+ minitest.expect(dart.equals(n, u4), true); |
+ minitest.expect(dart.equals(u1, n), true); |
+ minitest.expect(dart.equals(u2, n), true); |
+ minitest.expect(dart.equals(u3, n), true); |
+ minitest.expect(dart.equals(u4, n), true); |
+ }, VoidToNull())); |
+ minitest.test('Equal int/other (static, null)', dart.fn(() => { |
+ let u1 = equality_test.getUndefined(equality_test.BluesBrother)(); |
+ let u2 = equality_test.getUndefined(core.String)(); |
+ let n = equality_test.hideNull(core.int)(null); |
+ let u3 = equality_test.getUndefined(core.bool)(); |
+ let u4 = equality_test.getUndefined(core.List)(); |
+ minitest.expect(n == n, true); |
+ minitest.expect(dart.equals(n, u1), true); |
+ minitest.expect(dart.equals(n, u2), true); |
+ minitest.expect(dart.equals(n, u3), true); |
+ minitest.expect(dart.equals(n, u4), true); |
+ minitest.expect(dart.equals(u1, n), true); |
+ minitest.expect(dart.equals(u2, n), true); |
+ minitest.expect(dart.equals(u3, n), true); |
+ minitest.expect(dart.equals(u4, n), true); |
+ }, VoidToNull())); |
+ minitest.test('Equal bool/other (static, null)', dart.fn(() => { |
+ let u1 = equality_test.getUndefined(equality_test.BluesBrother)(); |
+ let u2 = equality_test.getUndefined(core.String)(); |
+ let u3 = equality_test.getUndefined(core.int)(); |
+ let n = equality_test.hideNull(core.bool)(null); |
+ let u4 = equality_test.getUndefined(core.List)(); |
+ minitest.expect(n == n, true); |
+ minitest.expect(dart.equals(n, u1), true); |
+ minitest.expect(dart.equals(n, u2), true); |
+ minitest.expect(dart.equals(n, u3), true); |
+ minitest.expect(dart.equals(n, u4), true); |
+ minitest.expect(dart.equals(u1, n), true); |
+ minitest.expect(dart.equals(u2, n), true); |
+ minitest.expect(dart.equals(u3, n), true); |
+ minitest.expect(dart.equals(u4, n), true); |
+ }, VoidToNull())); |
+ minitest.test('Equal List/other (static, null)', dart.fn(() => { |
+ let u1 = equality_test.getUndefined(equality_test.BluesBrother)(); |
+ let u2 = equality_test.getUndefined(core.String)(); |
+ let u3 = equality_test.getUndefined(core.int)(); |
+ let u4 = equality_test.getUndefined(core.bool)(); |
+ let n = equality_test.hideNull(core.List)(null); |
+ minitest.expect(dart.equals(n, n), true); |
+ minitest.expect(dart.equals(n, u1), true); |
+ minitest.expect(dart.equals(n, u2), true); |
+ minitest.expect(dart.equals(n, u3), true); |
+ minitest.expect(dart.equals(n, u4), true); |
+ minitest.expect(dart.equals(u1, n), true); |
+ minitest.expect(dart.equals(u2, n), true); |
+ minitest.expect(dart.equals(u3, n), true); |
+ minitest.expect(dart.equals(u4, n), true); |
+ }, VoidToNull())); |
+ }, VoidToNull())); |
+ }; |
+ dart.fn(equality_test.main, VoidTodynamic()); |
+ dart.trackLibraries("equality_test", { |
+ "equality_test.dart": equality_test |
+ }, null); |
+ // Exports: |
+ return { |
+ equality_test: equality_test |
+ }; |
+}); |