|
@@ -232,6 +232,31 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.BooleanTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+"_testIdentity",
|
|
|
+smalltalk.method({
|
|
|
+selector: "testIdentity",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq_eq", [false])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [(0)])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [false])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [""])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send(false, "__eq_eq", [true])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(false, "__eq_eq", [false])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
|
|
|
+return self;},
|
|
|
+args: [],
|
|
|
+source: "testIdentity\x0a\x09\x22We're on top of JS...just be sure to check the basics!\x22\x0a\x0a\x09self deny: 0 == false. \x0a\x09self deny: false == 0.\x0a\x09self deny: '' == false.\x0a\x09self deny: false == ''.\x0a\x0a\x09self assert: true == true.\x0a\x09self deny: false == true.\x0a\x09self deny: true == false.\x0a\x09self assert: false == false.\x0a\x0a\x09\x22JS may do some type coercing after sending a message\x22\x0a\x09self assert: true yourself == true.\x0a\x09self assert: true yourself == true yourself",
|
|
|
+messageSends: ["deny:", "==", "assert:", "yourself"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.BooleanTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
"_testIfTrueIfFalse",
|
|
|
smalltalk.method({
|
|
@@ -1138,10 +1163,12 @@ var o=nil;
|
|
|
(o=smalltalk.send((smalltalk.Object || Object), "_new", []));
|
|
|
smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq_eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
|
|
|
smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [o])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq_eq", [o])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq_eq", [smalltalk.send(o, "_yourself", [])])]);
|
|
|
return self;},
|
|
|
args: [],
|
|
|
-source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o",
|
|
|
-messageSends: ["new", "deny:", "==", "assert:"],
|
|
|
+source: "testIdentity\x0a\x09| o |\x0a\x09o := Object new.\x0a\x09self deny: o == Object new.\x0a\x09self assert: o == o.\x0a\x09self assert: o yourself == o.\x0a\x09self assert: o == o yourself",
|
|
|
+messageSends: ["new", "deny:", "==", "assert:", "yourself"],
|
|
|
referencedClasses: ["Object"]
|
|
|
}),
|
|
|
smalltalk.ObjectTest);
|
|
@@ -1750,6 +1777,26 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+"_testIdentity",
|
|
|
+smalltalk.method({
|
|
|
+selector: "testIdentity",
|
|
|
+category: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", ["hello"])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send("hello", "__eq_eq", ["world"])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send("hello", "__eq_eq", [smalltalk.send("hello", "_yourself", [])])]);
|
|
|
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send("hello", "_yourself", []), "__eq_eq", ["hello"])]);
|
|
|
+smalltalk.send(self, "_deny_", [smalltalk.send("", "__eq_eq", [(0)])]);
|
|
|
+return self;},
|
|
|
+args: [],
|
|
|
+source: "testIdentity\x0a\x09self assert: 'hello' == 'hello'.\x0a\x09self deny: 'hello' == 'world'.\x0a\x0a\x09self assert: 'hello' == 'hello' yourself.\x0a\x09self assert: 'hello' yourself == 'hello'.\x0a\x0a\x09\x22test JS falsy value\x22\x0a\x09self deny: '' == 0",
|
|
|
+messageSends: ["assert:", "==", "deny:", "yourself"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
"_testIncludesSubString",
|
|
|
smalltalk.method({
|