From: Jean Privat Date: Tue, 26 Nov 2013 20:37:47 +0000 (-0500) Subject: tests: replace usage of `is` with `is_same_instance` X-Git-Tag: v0.6.4~58^2~8^2~5 X-Git-Url: http://nitlanguage.org tests: replace usage of `is` with `is_same_instance` also remove old `test_eq*.nit` tests Signed-off-by: Jean Privat --- diff --git a/tests/base_eq.nit b/tests/base_eq.nit index d09a90d..f057695 100644 --- a/tests/base_eq.nit +++ b/tests/base_eq.nit @@ -33,7 +33,7 @@ class B return false end - return a.a is _a + return a.a.is_same_instance(_a) end init(b: Int) @@ -64,12 +64,12 @@ b1.is_same_type(b2).output '\n'.output -(a1 is a1).output -(a1 is a2).output -(not a1 is a3).output -(not a1 is b1).output -(not b1 is b2).output -(not b1 is b3).output +(a1.is_same_instance(a1)).output +(a1.is_same_instance(a2)).output +(not a1.is_same_instance(a3)).output +(not a1.is_same_instance(b1)).output +(not b1.is_same_instance(b2)).output +(not b1.is_same_instance(b3)).output '\n'.output diff --git a/tests/base_eq_float.nit b/tests/base_eq_float.nit index c2b63c6..fa62db9 100644 --- a/tests/base_eq_float.nit +++ b/tests/base_eq_float.nit @@ -37,62 +37,62 @@ op.output om.output o1.output -(fp is fp).output -(fp is fm).output -(not fp is f1).output -(fp is ofp).output -(fp is ofm).output -(not fp is of1).output -(fp is op).output -(fp is om).output -(not fp is o1).output +(fp.is_same_instance(fp)).output +(fp.is_same_instance(fm)).output +(not fp.is_same_instance(f1)).output +(fp.is_same_instance(ofp)).output +(fp.is_same_instance(ofm)).output +(not fp.is_same_instance(of1)).output +(fp.is_same_instance(op)).output +(fp.is_same_instance(om)).output +(not fp.is_same_instance(o1)).output '\n'.output -(fm is fp).output -(fm is fm).output -(not fm is f1).output -(fm is ofp).output -(fm is ofm).output -(not fm is of1).output -(fm is op).output -(fm is om).output -(not fm is o1).output +(fm.is_same_instance(fp)).output +(fm.is_same_instance(fm)).output +(not fm.is_same_instance(f1)).output +(fm.is_same_instance(ofp)).output +(fm.is_same_instance(ofm)).output +(not fm.is_same_instance(of1)).output +(fm.is_same_instance(op)).output +(fm.is_same_instance(om)).output +(not fm.is_same_instance(o1)).output '\n'.output -(ofp is fp).output -(ofp is fm).output -(not ofp is f1).output -(ofp is ofp).output -(ofp is ofm).output -(not ofp is of1).output -(ofp is op).output -(ofp is om).output -(not ofp is o1).output +(ofp.is_same_instance(fp)).output +(ofp.is_same_instance(fm)).output +(not ofp.is_same_instance(f1)).output +(ofp.is_same_instance(ofp)).output +(ofp.is_same_instance(ofm)).output +(not ofp.is_same_instance(of1)).output +(ofp.is_same_instance(op)).output +(ofp.is_same_instance(om)).output +(not ofp.is_same_instance(o1)).output '\n'.output -(ofm is fp).output -(ofm is fm).output -(not ofm is f1).output -(ofm is ofp).output -(ofm is ofm).output -(not ofm is of1).output -(ofm is op).output -(ofm is om).output -(not ofm is o1).output +(ofm.is_same_instance(fp)).output +(ofm.is_same_instance(fm)).output +(not ofm.is_same_instance(f1)).output +(ofm.is_same_instance(ofp)).output +(ofm.is_same_instance(ofm)).output +(not ofm.is_same_instance(of1)).output +(ofm.is_same_instance(op)).output +(ofm.is_same_instance(om)).output +(not ofm.is_same_instance(o1)).output '\n'.output -(op is fp).output -(op is fm).output -(not op is f1).output -(op is ofp).output -(op is ofm).output -(not op is of1).output -(op is op).output -(op is om).output -(not op is o1).output +(op.is_same_instance(fp)).output +(op.is_same_instance(fm)).output +(not op.is_same_instance(f1)).output +(op.is_same_instance(ofp)).output +(op.is_same_instance(ofm)).output +(not op.is_same_instance(of1)).output +(op.is_same_instance(op)).output +(op.is_same_instance(om)).output +(not op.is_same_instance(o1)).output '\n'.output -(om is fp).output -(om is fm).output -(not om is f1).output -(om is ofp).output -(om is ofm).output -(not om is of1).output -(om is op).output -(om is om).output -(not om is o1).output +(om.is_same_instance(fp)).output +(om.is_same_instance(fm)).output +(not om.is_same_instance(f1)).output +(om.is_same_instance(ofp)).output +(om.is_same_instance(ofm)).output +(not om.is_same_instance(of1)).output +(om.is_same_instance(op)).output +(om.is_same_instance(om)).output +(not om.is_same_instance(o1)).output diff --git a/tests/base_eq_int.nit b/tests/base_eq_int.nit index e92796d..626ee9f 100644 --- a/tests/base_eq_int.nit +++ b/tests/base_eq_int.nit @@ -33,13 +33,13 @@ var e: Object = 5.0 '\n'.output -(a is 5).output -(not a is 6).output -(a is a).output -(a is b).output -(a is c).output -(not a is d).output -(not a is e).output +(a.is_same_instance(5)).output +(not a.is_same_instance(6)).output +(a.is_same_instance(a)).output +(a.is_same_instance(b)).output +(a.is_same_instance(c)).output +(not a.is_same_instance(d)).output +(not a.is_same_instance(e)).output '\n'.output @@ -53,13 +53,13 @@ var e: Object = 5.0 '\n'.output -(c is 5).output -(not c is 6).output -(c is a).output -(c is b).output -(c is c).output -(not c is d).output -(not c is e).output +(c.is_same_instance(5)).output +(not c.is_same_instance(6)).output +(c.is_same_instance(a)).output +(c.is_same_instance(b)).output +(c.is_same_instance(c)).output +(not c.is_same_instance(d)).output +(not c.is_same_instance(e)).output '\n'.output diff --git a/tests/base_eq_null_notnull.nit b/tests/base_eq_null_notnull.nit index ef08d2c..f6d7424 100644 --- a/tests/base_eq_null_notnull.nit +++ b/tests/base_eq_null_notnull.nit @@ -17,10 +17,10 @@ import end class Object - fun ==(o: nullable Object): Bool do return self is o + fun ==(o: nullable Object): Bool do return self.is_same_instance(o) fun !=(o: nullable Object): Bool do return not (self == o) + fun is_same_instance(other: nullable Object): Bool is intern end - class Bool fun output is intern end diff --git a/tests/base_int.nit b/tests/base_int.nit index cc452e4..8b93673 100644 --- a/tests/base_int.nit +++ b/tests/base_int.nit @@ -35,8 +35,8 @@ import kernel (2==2).output '\n'.output -(not 1 is 2).output -(2 is 2).output +(not 1.is_same_instance(2)).output +(2.is_same_instance(2)).output '\n'.output (not 1>2).output diff --git a/tests/base_int2.nit b/tests/base_int2.nit index 0f15bad..eb1e7dc 100644 --- a/tests/base_int2.nit +++ b/tests/base_int2.nit @@ -39,8 +39,8 @@ fun three: Int do return 3 (two==two).output '\n'.output -(not one is two).output -(two is two).output +(not one.is_same_instance(two)).output +(two.is_same_instance(two)).output '\n'.output (not one>two).output diff --git a/tests/base_no_object.nit b/tests/base_no_object.nit index 8ed75ce..ddcad3c 100644 --- a/tests/base_no_object.nit +++ b/tests/base_no_object.nit @@ -10,4 +10,4 @@ end var a = new A a.foo -#alt1# if a is a then 2.output +#alt1# if a isa Int then 2.output diff --git a/tests/base_var_type_evolution_null5.nit b/tests/base_var_type_evolution_null5.nit index d3acc6e..23cd598 100644 --- a/tests/base_var_type_evolution_null5.nit +++ b/tests/base_var_type_evolution_null5.nit @@ -15,10 +15,10 @@ import end class Object - fun ==(o: nullable Object): Bool do return self is o - fun !=(o: nullable Object): Bool do return not self is o + fun ==(o: nullable Object): Bool do return self.is_same_instance(o) + fun !=(o: nullable Object): Bool do return not self.is_same_instance(o) + fun is_same_instance(other: nullable Object): Bool is intern end - class A end diff --git a/tests/base_var_type_evolution_null_while.nit b/tests/base_var_type_evolution_null_while.nit index 56eacc1..71ca47a 100644 --- a/tests/base_var_type_evolution_null_while.nit +++ b/tests/base_var_type_evolution_null_while.nit @@ -15,10 +15,10 @@ import end class Object - fun ==(o: nullable Object): Bool do return self is o - fun !=(o: nullable Object): Bool do return not self is o + fun ==(o: nullable Object): Bool do return self.is_same_instance(o) + fun !=(o: nullable Object): Bool do return not self.is_same_instance(o) + fun is_same_instance(other: nullable Object): Bool is intern end - class A end diff --git a/tests/base_var_type_evolution_nullable.nit b/tests/base_var_type_evolution_nullable.nit index 1607d3b..a8766fe 100644 --- a/tests/base_var_type_evolution_nullable.nit +++ b/tests/base_var_type_evolution_nullable.nit @@ -13,10 +13,10 @@ # limitations under the License. import end - class Object - fun ==(o: nullable Object): Bool do return self is o + fun ==(o: nullable Object): Bool do return self.is_same_instance(o) fun !=(o: nullable Object): Bool do return not self == o + fun is_same_instance(o: nullable Object): Bool is intern end class A end diff --git a/tests/error_expr_not_ok.nit b/tests/error_expr_not_ok.nit index 0f3063d..0b25f5c 100644 --- a/tests/error_expr_not_ok.nit +++ b/tests/error_expr_not_ok.nit @@ -83,9 +83,9 @@ trash(fail == fail) # no rtype trash(fail != 1) # no rtype trash(1 != fail) trash(fail != fail) # no rtype -trash(fail is 1) -trash(1 is fail) -trash(fail is fail) +trash(fail.is_same_instance(1)) +trash(1.is_same_instance(fail)) +trash(fail.is_same_instance(fail)) trash(fail < 1) # no rtype trash(1 < fail) trash(fail < fail) # no rtype diff --git a/tests/example_point.nit b/tests/example_point.nit index 39738d7..8a568f6 100644 --- a/tests/example_point.nit +++ b/tests/example_point.nit @@ -53,7 +53,7 @@ private redef fun ==(p) do - return not p is null and p isa Point and _x == p.x and _y == p.y + return p isa Point and _x == p.x and _y == p.y end diff --git a/tests/sav/base_no_object_alt1.res b/tests/sav/base_no_object_alt1.res index df44934..4965b26 100644 --- a/tests/sav/base_no_object_alt1.res +++ b/tests/sav/base_no_object_alt1.res @@ -1,2 +1,2 @@ -alt/base_no_object_alt1.nit:13,4--9: Type Error: missing primitive class `Bool'. -alt/base_no_object_alt1.nit:13,4--9: Type Error: missing primitive class `Bool'. +alt/base_no_object_alt1.nit:13,4--12: Type Error: missing primitive class `Bool'. +alt/base_no_object_alt1.nit:13,4--12: Type Error: missing primitive class `Bool'. diff --git a/tests/sav/error_expr_not_ok.res b/tests/sav/error_expr_not_ok.res index 2df261f..033aaaa 100644 --- a/tests/sav/error_expr_not_ok.res +++ b/tests/sav/error_expr_not_ok.res @@ -59,12 +59,9 @@ error_expr_not_ok.nit:84,12--15: Error: Method or variable 'fail' unknown in Sys error_expr_not_ok.nit:84,7--15: Type error: expected A, got Bool error_expr_not_ok.nit:85,7--10: Error: Method or variable 'fail' unknown in Sys. error_expr_not_ok.nit:86,7--10: Error: Method or variable 'fail' unknown in Sys. -error_expr_not_ok.nit:86,7--15: Type error: expected A, got Bool -error_expr_not_ok.nit:87,12--15: Error: Method or variable 'fail' unknown in Sys. -error_expr_not_ok.nit:87,7--15: Type error: expected A, got Bool +error_expr_not_ok.nit:87,26--29: Error: Method or variable 'fail' unknown in Sys. +error_expr_not_ok.nit:87,7--30: Type error: expected A, got Bool error_expr_not_ok.nit:88,7--10: Error: Method or variable 'fail' unknown in Sys. -error_expr_not_ok.nit:88,15--18: Error: Method or variable 'fail' unknown in Sys. -error_expr_not_ok.nit:88,7--18: Type error: expected A, got Bool error_expr_not_ok.nit:89,7--10: Error: Method or variable 'fail' unknown in Sys. error_expr_not_ok.nit:90,11--14: Error: Method or variable 'fail' unknown in Sys. error_expr_not_ok.nit:90,7--14: Type error: expected A, got Bool diff --git a/tests/sav/error_expr_not_ok_alt2.res b/tests/sav/error_expr_not_ok_alt2.res index a39fb74..2c60a13 100644 --- a/tests/sav/error_expr_not_ok_alt2.res +++ b/tests/sav/error_expr_not_ok_alt2.res @@ -20,9 +20,7 @@ alt/error_expr_not_ok_alt2.nit:78,7--19: Type error: expected A, got Bool alt/error_expr_not_ok_alt2.nit:79,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt2.nit:81,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt2.nit:84,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt2.nit:86,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt2.nit:87,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt2.nit:88,7--18: Type error: expected A, got Bool +alt/error_expr_not_ok_alt2.nit:87,7--30: Type error: expected A, got Bool alt/error_expr_not_ok_alt2.nit:90,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt2.nit:93,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt2.nit:96,7--15: Type error: expected A, got Bool diff --git a/tests/sav/error_expr_not_ok_alt3.res b/tests/sav/error_expr_not_ok_alt3.res index 18f57f3..7aaa75d 100644 --- a/tests/sav/error_expr_not_ok_alt3.res +++ b/tests/sav/error_expr_not_ok_alt3.res @@ -20,9 +20,7 @@ alt/error_expr_not_ok_alt3.nit:78,7--19: Type error: expected A, got Bool alt/error_expr_not_ok_alt3.nit:79,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt3.nit:81,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt3.nit:84,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt3.nit:86,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt3.nit:87,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt3.nit:88,7--18: Type error: expected A, got Bool +alt/error_expr_not_ok_alt3.nit:87,7--30: Type error: expected A, got Bool alt/error_expr_not_ok_alt3.nit:90,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt3.nit:93,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt3.nit:96,7--15: Type error: expected A, got Bool diff --git a/tests/sav/error_expr_not_ok_alt4.res b/tests/sav/error_expr_not_ok_alt4.res index 544d47c..79de0b8 100644 --- a/tests/sav/error_expr_not_ok_alt4.res +++ b/tests/sav/error_expr_not_ok_alt4.res @@ -47,9 +47,9 @@ alt/error_expr_not_ok_alt4.nit:82,7--18: Type error: expected A, got Bool alt/error_expr_not_ok_alt4.nit:83,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt4.nit:84,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt4.nit:85,7--18: Type error: expected A, got Bool -alt/error_expr_not_ok_alt4.nit:86,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt4.nit:87,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt4.nit:88,7--18: Type error: expected A, got Bool +alt/error_expr_not_ok_alt4.nit:86,7--30: Type error: expected A, got Bool +alt/error_expr_not_ok_alt4.nit:87,7--30: Type error: expected A, got Bool +alt/error_expr_not_ok_alt4.nit:88,7--33: Type error: expected A, got Bool alt/error_expr_not_ok_alt4.nit:89,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt4.nit:90,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt4.nit:91,7--17: Type error: expected A, got Bool diff --git a/tests/sav/error_expr_not_ok_alt5.res b/tests/sav/error_expr_not_ok_alt5.res index ead84b9..ea9447d 100644 --- a/tests/sav/error_expr_not_ok_alt5.res +++ b/tests/sav/error_expr_not_ok_alt5.res @@ -43,9 +43,9 @@ alt/error_expr_not_ok_alt5.nit:82,7--18: Type error: expected A, got Bool alt/error_expr_not_ok_alt5.nit:83,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt5.nit:84,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt5.nit:85,7--18: Type error: expected A, got Bool -alt/error_expr_not_ok_alt5.nit:86,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt5.nit:87,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt5.nit:88,7--18: Type error: expected A, got Bool +alt/error_expr_not_ok_alt5.nit:86,7--30: Type error: expected A, got Bool +alt/error_expr_not_ok_alt5.nit:87,7--30: Type error: expected A, got Bool +alt/error_expr_not_ok_alt5.nit:88,7--33: Type error: expected A, got Bool alt/error_expr_not_ok_alt5.nit:89,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt5.nit:90,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt5.nit:91,7--17: Type error: expected A, got Bool diff --git a/tests/sav/error_expr_not_ok_alt6.res b/tests/sav/error_expr_not_ok_alt6.res index afbbbd8..5320e63 100644 --- a/tests/sav/error_expr_not_ok_alt6.res +++ b/tests/sav/error_expr_not_ok_alt6.res @@ -47,9 +47,9 @@ alt/error_expr_not_ok_alt6.nit:82,7--18: Type error: expected A, got Bool alt/error_expr_not_ok_alt6.nit:83,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt6.nit:84,7--15: Type error: expected A, got Bool alt/error_expr_not_ok_alt6.nit:85,7--18: Type error: expected A, got Bool -alt/error_expr_not_ok_alt6.nit:86,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt6.nit:87,7--15: Type error: expected A, got Bool -alt/error_expr_not_ok_alt6.nit:88,7--18: Type error: expected A, got Bool +alt/error_expr_not_ok_alt6.nit:86,7--30: Type error: expected A, got Bool +alt/error_expr_not_ok_alt6.nit:87,7--30: Type error: expected A, got Bool +alt/error_expr_not_ok_alt6.nit:88,7--33: Type error: expected A, got Bool alt/error_expr_not_ok_alt6.nit:89,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt6.nit:90,7--14: Type error: expected A, got Bool alt/error_expr_not_ok_alt6.nit:91,7--17: Type error: expected A, got Bool diff --git a/tests/sav/test_eq.res b/tests/sav/test_eq.res deleted file mode 100644 index cf4e79f..0000000 --- a/tests/sav/test_eq.res +++ /dev/null @@ -1,41 +0,0 @@ -* literal int -true -true -true -true -* int variable -true -true -true -true -true -* same type object -true -true -true -true -true -* different type object -true -true -true -* boxed native -true -true -true -true -true -true -true -* null -true -true -true -true -true -true -true -true -true -true -true diff --git a/tests/sav/test_eq2.res b/tests/sav/test_eq2.res deleted file mode 100644 index b5986f6..0000000 --- a/tests/sav/test_eq2.res +++ /dev/null @@ -1,28 +0,0 @@ -* literal int -true -true -true -true -* int variable -true -true -true -true -true -* same type object -true -true -true -true -true -true -* different type object -true -true -* boxed native -true -true -true -true -true -true diff --git a/tests/sav/test_equal.res b/tests/sav/test_equal.res deleted file mode 100644 index 0be6ecd..0000000 --- a/tests/sav/test_equal.res +++ /dev/null @@ -1 +0,0 @@ -okokokokokokokokokokokokokokokokokokokok \ No newline at end of file diff --git a/tests/sav/test_equal_nil.res b/tests/sav/test_equal_nil.res deleted file mode 100644 index 4d7eaaf..0000000 --- a/tests/sav/test_equal_nil.res +++ /dev/null @@ -1 +0,0 @@ -111111111 \ No newline at end of file diff --git a/tests/test_eq.nit b/tests/test_eq.nit deleted file mode 100644 index 1c5a1e0..0000000 --- a/tests/test_eq.nit +++ /dev/null @@ -1,80 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2004-2008 Jean Privat -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -var i = 1 -var j = 1 -var k = 2 -var s = "Maison" -var t = "Maison" -var a: Object -var b: Object - -print("* literal int") -print(1 is 1) -print(1 is 1) -print(not 1 is 2) -print(not 1 is 2) -print("* int variable") -print(i is j) -print(j is i) -print(not i is k) -print(i is 1) -print(not i is 2) - -print("* same type object") -print(s is s) -a = s -print(s is a) -a = s -print(not s is t) -b = t -print(not s is b) -print(not s is b) - -print("* different type object") -a = s.iterator -print(not s is a) -a = 5 -print(not s is a) -print(not s is 5) - -print("* boxed native") -a = i -b = i -print(i is a) -print(b is i) -print(b is a) -a = 5 -b = 5.ascii -print(not 5 is 5.ascii) -print(not a is 5.ascii) -print(not 5 is b) -print(not a is b) - -print("* null") -var a1: nullable Object = null -var b1: nullable Object = null -print(not null is s) -print(not s is null) -print(not a1 is s) -print(not s is a1) -print(null is null) -print(b1 is null) -print(b1 is a1) -print(not i is null) -print(not i is a1) -print(not null is i) -print(not a1 is i) diff --git a/tests/test_eq2.nit b/tests/test_eq2.nit deleted file mode 100644 index 0af50af..0000000 --- a/tests/test_eq2.nit +++ /dev/null @@ -1,65 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2004-2008 Jean Privat -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -var i = 1 -var j = 1 -var k = 2 -var s = "Maison" -var t = "Maison" -var u = "Arbre" -var a: Object -var b: Object -print("* literal int") -print(1 == 1) -print(not 1 != 1) -print(not 1 == 2) -print(1 != 2) -print("* int variable") -print(i == j) -print(j == i) -print(i != k) -print(i == 1) -print(i != 2) - -print("* same type object") -print(s == s) -a = s -print(a == s) -a = s -print(s == t) -b = t -print(b == s) -print(not s == u) -b = u -print(not b == s) - -print("* different type object") -a = s.iterator -print(not a == s) -a = 5 -print(not a == s) - -print("* boxed native") -a = i -b = i -print(a == i) -print(b == i) -print(b == a) -a = 5 -b = 5.ascii -print(not a == 5.ascii) -print(not b == 5) -print(not a == b) diff --git a/tests/test_equal.nit b/tests/test_equal.nit deleted file mode 100644 index 9a7f067..0000000 --- a/tests/test_equal.nit +++ /dev/null @@ -1,48 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2004-2008 Jean Privat -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -var i: Int -var j: Int -var a: Object -var b: Object -if 1 == 1 then printn("ok") else printn("fail") -if not 1 == 2 then printn("ok") else printn("fail") -if 1 is 1 then printn("ok") else printn("fail") -if not 1 is 2 then printn("ok") else printn("fail") -i = 1 -if i == 1 then printn("ok") else printn("fail") -if not i == 2 then printn("ok") else printn("fail") -if i is 1 then printn("ok") else printn("fail") -if not i is 2 then printn("ok") else printn("fail") -j = 1 -if i == j then printn("ok") else printn("fail") -if i is j then printn("ok") else printn("fail") -a = 1 -if a == i then printn("ok") else printn("fail") -if a is i then printn("ok") else printn("fail") -a = i -if a == i then printn("ok") else printn("fail") -if a is i then printn("ok") else printn("fail") -b = a -if a == b then printn("ok") else printn("fail") -if a is b then printn("ok") else printn("fail") -b = i -if a == b then printn("ok") else printn("fail") -if a is b then printn("ok") else printn("fail") -b = 1 -if a == b then printn("ok") else printn("fail") -if a is b then printn("ok") else printn("fail") diff --git a/tests/test_equal_nil.nit b/tests/test_equal_nil.nit deleted file mode 100644 index 74342a2..0000000 --- a/tests/test_equal_nil.nit +++ /dev/null @@ -1,36 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2004-2008 Jean Privat -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -class A - init do end -end - -var a: nullable A = new A -var b: nullable A = null -if a == null then printn(0) else printn(1) -if a is null then printn(0) else printn(1) -#if b == null then printn(1) else printn(0) -if b is null then printn(1) else printn(0) -if a == a then printn(1) else printn(0) -if a is a then printn(1) else printn(0) -#if b == b then printn(1) else printn(0) -if b is b then printn(1) else printn(0) -if a == b then printn(0) else printn(1) -if a is b then printn(0) else printn(1) -#if b == a then printn(0) else printn(1) -if b is a then printn(0) else printn(1) - diff --git a/tests/test_symbol.nit b/tests/test_symbol.nit index 5b152a4..da373ea 100644 --- a/tests/test_symbol.nit +++ b/tests/test_symbol.nit @@ -27,12 +27,12 @@ s3.to_s.output 1.output (s1.to_s == s2.to_s).output -(s1.to_s is s2.to_s).output +(s1.to_s.is_same_instance(s2.to_s)).output (s1.to_s == s3.to_s).output -(s1.to_s is s3.to_s).output +(s1.to_s.is_same_instance(s3.to_s)).output 2.output (s1 == s2).output -(s1 is s2).output +(s1.is_same_instance(s2)).output (s1 == s3).output -(s1 is s3).output +(s1.is_same_instance(s3)).output