Browse Source

More unit tests

Nicolas Petton 12 years ago
parent
commit
4fdcbcc8d4
6 changed files with 751 additions and 17 deletions
  1. 1 1
      js/Kernel-Methods.deploy.js
  2. 3 2
      js/Kernel-Methods.js
  3. 250 2
      js/Kernel-Tests.deploy.js
  4. 346 8
      js/Kernel-Tests.js
  5. 6 1
      st/Kernel-Methods.st
  6. 145 3
      st/Kernel-Tests.st

+ 1 - 1
js/Kernel-Methods.deploy.js

@@ -330,7 +330,7 @@ fn: function (aBlock){
 var self=this;
 var success=nil;
 success=false;
-smalltalk.send((function(){smalltalk.send(self, "_value", []);success=true;return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
+return smalltalk.send((function(){smalltalk.send(self, "_value", []);success=true;return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
 return self;}
 }),
 smalltalk.BlockClosure);

+ 3 - 2
js/Kernel-Methods.js

@@ -195,6 +195,7 @@ smalltalk.CompiledMethod);
 
 
 smalltalk.addClass('BlockClosure', smalltalk.Object, [], 'Kernel-Methods');
+smalltalk.BlockClosure.comment=unescape('A%20BlockClosure%20is%20a%20lexical%20closure.%0AThe%20JavaScript%20representation%20is%20a%20function.%0A%0AA%20BlockClosure%20is%20evaluated%20with%20the%20%23value*%20methods%20in%20the%20%27evaluating%27%20protocol.')
 smalltalk.addMethod(
 unescape('_compiledSource'),
 smalltalk.method({
@@ -476,10 +477,10 @@ fn: function (aBlock){
 var self=this;
 var success=nil;
 success=false;
-smalltalk.send((function(){smalltalk.send(self, "_value", []);success=true;return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
+return smalltalk.send((function(){smalltalk.send(self, "_value", []);success=true;return smalltalk.send(aBlock, "_value", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){((($receiver = success).klass === smalltalk.Boolean) ? (! $receiver ? (function(){return smalltalk.send(aBlock, "_value", []);})() : nil) : smalltalk.send($receiver, "_ifFalse_", [(function(){return smalltalk.send(aBlock, "_value", []);})]));return smalltalk.send(ex, "_signal", []);})]);
 return self;},
 args: ["aBlock"],
-source: unescape('ensure%3A%20aBlock%0A%09%7C%20success%20%7C%0A%09success%20%3A%3D%20false.%0A%09%5Bself%20value.%20success%20%3A%3D%20true.%20aBlock%20value%5D%0A%09%09on%3A%20Error%0A%09%09do%3A%20%5B%3Aex%20%7C%0A%09%09%09success%20ifFalse%3A%20%5BaBlock%20value%5D.%0A%09%09%09ex%20signal%5D'),
+source: unescape('ensure%3A%20aBlock%0A%09%7C%20success%20%7C%0A%09success%20%3A%3D%20false.%0A%09%5E%5Bself%20value.%20success%20%3A%3D%20true.%20aBlock%20value%5D%0A%09%09on%3A%20Error%0A%09%09do%3A%20%5B%3Aex%20%7C%0A%09%09%09success%20ifFalse%3A%20%5BaBlock%20value%5D.%0A%09%09%09ex%20signal%5D'),
 messageSends: ["on:do:", "value", "ifFalse:", "signal"],
 referencedClasses: ["Error"]
 }),

+ 250 - 2
js/Kernel-Tests.deploy.js

@@ -269,6 +269,21 @@ return self;}
 }),
 smalltalk.BooleanTest);
 
+smalltalk.addMethod(
+'_testIdentity',
+smalltalk.method({
+selector: 'testIdentity',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
+smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
+return self;}
+}),
+smalltalk.BooleanTest);
+
 
 
 smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
@@ -394,8 +409,99 @@ smalltalk.method({
 selector: 'testCopying',
 fn: function (){
 var self=this;
-smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq", [(1)])]);
-smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testMinMax',
+smalltalk.method({
+selector: 'testMinMax',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testIdentity',
+smalltalk.method({
+selector: 'testIdentity',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
+smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
+smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testSqrt',
+smalltalk.method({
+selector: 'testSqrt',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testSquared',
+smalltalk.method({
+selector: 'testSquared',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testTimesRepeat',
+smalltalk.method({
+selector: 'testTimesRepeat',
+fn: function (){
+var self=this;
+var i=nil;
+i=(0);
+smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
+smalltalk.send(self, "_assert_equals_", [i, (0)]);
+smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
+smalltalk.send(self, "_assert_equals_", [i, (5)]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testTo',
+smalltalk.method({
+selector: 'testTo',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
+return self;}
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+'_testToBy',
+smalltalk.method({
+selector: 'testToBy',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
+smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
 return self;}
 }),
 smalltalk.NumberTest);
@@ -592,3 +698,145 @@ return self;}
 smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
 
 
+smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+'_testValue',
+smalltalk.method({
+selector: 'testValue',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testOnDo',
+smalltalk.method({
+selector: 'testOnDo',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testEnsure',
+smalltalk.method({
+selector: 'testEnsure',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testNumArgs',
+smalltalk.method({
+selector: 'testNumArgs',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testValueWithPossibleArguments',
+smalltalk.method({
+selector: 'testValueWithPossibleArguments',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testWhileTrue',
+smalltalk.method({
+selector: 'testWhileTrue',
+fn: function (){
+var self=this;
+var i=nil;
+i=(0);
+(function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
+smalltalk.send(self, "_assert_equals_", [i, (5)]);
+i=(0);
+(function(){while((function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
+smalltalk.send(self, "_assert_equals_", [i, (5)]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testWhileFalse',
+smalltalk.method({
+selector: 'testWhileFalse',
+fn: function (){
+var self=this;
+var i=nil;
+i=(0);
+(function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
+smalltalk.send(self, "_assert_equals_", [i, (6)]);
+i=(0);
+(function(){while(!(function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
+smalltalk.send(self, "_assert_equals_", [i, (6)]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+'_testCompiledSource',
+smalltalk.method({
+selector: 'testCompiledSource',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), unescape("function%20%28%29%7Breturn%20%281%29%20+%20%281%29%3B%7D")]);
+return self;}
+}),
+smalltalk.BlockClosureTest);
+
+
+
+smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+'_testEquality',
+smalltalk.method({
+selector: 'testEquality',
+fn: function (){
+var self=this;
+var o=nil;
+o=smalltalk.send((smalltalk.Object || Object), "_new", []);
+smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
+return self;}
+}),
+smalltalk.ObjectTest);
+
+smalltalk.addMethod(
+'_testIdentity',
+smalltalk.method({
+selector: 'testIdentity',
+fn: function (){
+var self=this;
+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])]);
+return self;}
+}),
+smalltalk.ObjectTest);
+
+
+

+ 346 - 8
js/Kernel-Tests.js

@@ -277,7 +277,7 @@ smalltalk.addMethod(
 unescape('_testLogic'),
 smalltalk.method({
 selector: unescape('testLogic'),
-category: 'not yet classified',
+category: 'tests',
 fn: function (){
 var self=this;
 (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_&", [true])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_&", [false])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [true])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_&", [false])]);})(self);
@@ -296,7 +296,7 @@ smalltalk.addMethod(
 unescape('_testEquality'),
 smalltalk.method({
 selector: unescape('testEquality'),
-category: 'not yet classified',
+category: 'tests',
 fn: function (){
 var self=this;
 smalltalk.send(self, "_deny_", [smalltalk.send((0), "__eq", [false])]);
@@ -321,7 +321,7 @@ smalltalk.addMethod(
 unescape('_testLogicKeywords'),
 smalltalk.method({
 selector: unescape('testLogicKeywords'),
-category: 'not yet classified',
+category: 'tests',
 fn: function (){
 var self=this;
 (function($rec){smalltalk.send($rec, "_assert_", [smalltalk.send(true, "_and_", [(function(){return true;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(true, "_and_", [(function(){return false;})])]);smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return true;})])]);return smalltalk.send($rec, "_deny_", [smalltalk.send(false, "_and_", [(function(){return false;})])]);})(self);
@@ -340,7 +340,7 @@ smalltalk.addMethod(
 unescape('_testIfTrueIfFalse'),
 smalltalk.method({
 selector: unescape('testIfTrueIfFalse'),
-category: 'not yet classified',
+category: 'tests',
 fn: function (){
 var self=this;
 smalltalk.send(self, "_assert_", [smalltalk.send(((($receiver = true).klass === smalltalk.Boolean) ? ($receiver ? (function(){return "alternative block";})() : nil) : smalltalk.send($receiver, "_ifTrue_", [(function(){return "alternative block";})])), "__eq", ["alternative block"])]);
@@ -359,6 +359,26 @@ referencedClasses: []
 }),
 smalltalk.BooleanTest);
 
+smalltalk.addMethod(
+unescape('_testIdentity'),
+smalltalk.method({
+selector: unescape('testIdentity'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [true])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [true])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(true, "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(true, "_yourself", []), "__eq_eq", [smalltalk.send(true, "_yourself", [])])]);
+smalltalk.send(self, "_deny_", [smalltalk.send(true, "__eq_eq", [false])]);
+return self;},
+args: [],
+source: unescape('testIdentity%0A%09self%20assert%3A%20true%20%3D%3D%20true.%0A%09self%20assert%3A%20true%20yourself%20%3D%3D%20true.%0A%09self%20assert%3A%20true%20%3D%3D%20true%20yourself.%0A%09self%20assert%3A%20true%20yourself%20%3D%3D%20true%20yourself.%0A%0A%09self%20deny%3A%20true%20%3D%3D%20false'),
+messageSends: ["assert:", unescape("%3D%3D"), "yourself", "deny:"],
+referencedClasses: []
+}),
+smalltalk.BooleanTest);
+
 
 
 smalltalk.addClass('NumberTest', smalltalk.TestCase, [], 'Kernel-Tests');
@@ -520,16 +540,142 @@ selector: unescape('testCopying'),
 category: 'tests',
 fn: function (){
 var self=this;
-smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq", [(1)])]);
-smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_copy", []), "__eq_eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_deepCopy", []), "__eq_eq", [(1)])]);
+return self;},
+args: [],
+source: unescape('testCopying%0A%09self%20assert%3A%201%20copy%20%3D%3D%201.%0A%09self%20assert%3A%201%20deepCopy%20%3D%3D%201'),
+messageSends: ["assert:", unescape("%3D%3D"), "copy", "deepCopy"],
+referencedClasses: []
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+unescape('_testMinMax'),
+smalltalk.method({
+selector: unescape('testMinMax'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_max_", [(5)]), (5)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((2), "_min_", [(5)]), (2)]);
+return self;},
+args: [],
+source: unescape('testMinMax%0A%09%0A%09self%20assert%3A%20%282%20max%3A%205%29%20equals%3A%205.%0A%09self%20assert%3A%20%282%20min%3A%205%29%20equals%3A%202'),
+messageSends: ["assert:equals:", "max:", "min:"],
+referencedClasses: []
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+unescape('_testIdentity'),
+smalltalk.method({
+selector: unescape('testIdentity'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send((0), "__eq_eq", [(0)])]);
+smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(0)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [(1)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send((1), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((1), "_yourself", []), "__eq_eq", [smalltalk.send((1), "_yourself", [])])]);
+smalltalk.send(self, "_deny_", [smalltalk.send((1), "__eq_eq", [(2)])]);
+return self;},
+args: [],
+source: unescape('testIdentity%0A%09self%20assert%3A%201%20%3D%3D%201.%0A%09self%20assert%3A%200%20%3D%3D%200.%0A%09self%20deny%3A%201%20%3D%3D%200.%0A%0A%09self%20assert%3A%201%20yourself%20%3D%3D%201.%0A%09self%20assert%3A%201%20%3D%3D%201%20yourself.%0A%09self%20assert%3A%201%20yourself%20%3D%3D%201%20yourself.%0A%09%0A%09self%20deny%3A%201%20%3D%3D%202'),
+messageSends: ["assert:", unescape("%3D%3D"), "deny:", "yourself"],
+referencedClasses: []
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+unescape('_testSqrt'),
+smalltalk.method({
+selector: unescape('testSqrt'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_sqrt", []), "__eq", [(2)])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((16), "_sqrt", []), "__eq", [(4)])]);
+return self;},
+args: [],
+source: unescape('testSqrt%0A%09%0A%09self%20assert%3A%204%20sqrt%20%3D%202.%0A%09self%20assert%3A%2016%20sqrt%20%3D%204'),
+messageSends: ["assert:", unescape("%3D"), "sqrt"],
+referencedClasses: []
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+unescape('_testSquared'),
+smalltalk.method({
+selector: unescape('testSquared'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send((4), "_squared", []), "__eq", [(16)])]);
 return self;},
 args: [],
-source: unescape('testCopying%0A%09self%20assert%3A%201%20copy%20%3D%201.%0A%09self%20assert%3A%201%20deepCopy%20%3D%201'),
-messageSends: ["assert:", unescape("%3D"), "copy", "deepCopy"],
+source: unescape('testSquared%0A%09%0A%09self%20assert%3A%204%20squared%20%3D%2016'),
+messageSends: ["assert:", unescape("%3D"), "squared"],
 referencedClasses: []
 }),
 smalltalk.NumberTest);
 
+smalltalk.addMethod(
+unescape('_testTimesRepeat'),
+smalltalk.method({
+selector: unescape('testTimesRepeat'),
+category: 'tests',
+fn: function (){
+var self=this;
+var i=nil;
+i=(0);
+smalltalk.send((0), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
+smalltalk.send(self, "_assert_equals_", [i, (0)]);
+smalltalk.send((5), "_timesRepeat_", [(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})]);
+smalltalk.send(self, "_assert_equals_", [i, (5)]);
+return self;},
+args: [],
+source: unescape('testTimesRepeat%0A%09%7C%20i%20%7C%0A%0A%09i%20%3A%3D%200.%0A%090%20timesRepeat%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%200.%0A%0A%095%20timesRepeat%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%205'),
+messageSends: ["timesRepeat:", unescape("+"), "assert:equals:"],
+referencedClasses: []
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+unescape('_testTo'),
+smalltalk.method({
+selector: unescape('testTo'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((1), "_to_", [(5)]), [(1), (2), (3), (4), (5)]]);
+return self;},
+args: [],
+source: unescape('testTo%0A%09self%20assert%3A%20%281%20to%3A%205%29%20equals%3A%20%23%281%202%203%204%205%29'),
+messageSends: ["assert:equals:", "to:"],
+referencedClasses: []
+}),
+smalltalk.NumberTest);
+
+smalltalk.addMethod(
+unescape('_testToBy'),
+smalltalk.method({
+selector: unescape('testToBy'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((0), "_to_by_", [(6), (2)]), [(0), (2), (4), (6)]]);
+smalltalk.send(self, "_should_raise_", [(function(){return smalltalk.send((1), "_to_by_", [(4), (0)]);}), (smalltalk.Error || Error)]);
+return self;},
+args: [],
+source: unescape('testToBy%0A%09self%20assert%3A%20%280%20to%3A%206%20by%3A%202%29%20equals%3A%20%23%280%202%204%206%29.%0A%0A%09self%20should%3A%20%5B1%20to%3A%204%20by%3A%200%5D%20raise%3A%20Error'),
+messageSends: ["assert:equals:", "to:by:", "should:raise:"],
+referencedClasses: ["Error"]
+}),
+smalltalk.NumberTest);
+
 
 
 smalltalk.addClass('JSObjectProxyTest', smalltalk.TestCase, [], 'Kernel-Tests');
@@ -797,3 +943,195 @@ referencedClasses: []
 smalltalk.PackageWithDefaultCommitPathChangedTest.klass);
 
 
+smalltalk.addClass('BlockClosureTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+unescape('_testValue'),
+smalltalk.method({
+selector: unescape('testValue'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_value", []), (2)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x){return ((($receiver = x).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));}), "_value_", [(2)]), (3)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(x, y){return ((($receiver = x).klass === smalltalk.Number) ? $receiver *y : smalltalk.send($receiver, "__star", [y]));}), "_value_value_", [(2), (4)]), (8)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b, c){return (1);}), "_value", []), (1)]);
+return self;},
+args: [],
+source: unescape('testValue%0A%09self%20assert%3A%20%28%5B1+1%5D%20value%29%20equals%3A%202.%0A%09self%20assert%3A%20%28%5B%3Ax%20%7C%20x%20+1%5D%20value%3A%202%29%20equals%3A%203.%0A%09self%20assert%3A%20%28%5B%3Ax%20%3Ay%20%7C%20x*y%5D%20value%3A%202%20value%3A%204%29%20equals%3A%208.%20%0A%0A%09%22Arguments%20are%20optional%20in%20Amber.%20This%20isn%27t%20ANSI%20compliant.%22%0A%0A%09self%20assert%3A%20%28%5B%3Aa%20%3Ab%20%3Ac%20%7C%201%5D%20value%29%20equals%3A%201'),
+messageSends: ["assert:equals:", "value", unescape("+"), "value:", "value:value:", unescape("*")],
+referencedClasses: []
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testOnDo'),
+smalltalk.method({
+selector: unescape('testOnDo'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send(smalltalk.send((smalltalk.Error || Error), "_new", []), "_signal", []);}), "_on_do_", [(smalltalk.Error || Error), (function(ex){return true;})])]);
+return self;},
+args: [],
+source: unescape('testOnDo%0A%09self%20assert%3A%20%28%5BError%20new%20signal%5D%20on%3A%20Error%20do%3A%20%5B%3Aex%20%7C%20true%5D%29'),
+messageSends: ["assert:", "on:do:", "signal", "new"],
+referencedClasses: ["Error"]
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testEnsure'),
+smalltalk.method({
+selector: unescape('testEnsure'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_", [smalltalk.send((function(){return smalltalk.send((smalltalk.Error || Error), "_new", []);}), "_ensure_", [(function(){return true;})])]);
+return self;},
+args: [],
+source: unescape('testEnsure%0A%09self%20assert%3A%20%28%5BError%20new%5D%20ensure%3A%20%5Btrue%5D%29'),
+messageSends: ["assert:", "ensure:", "new"],
+referencedClasses: ["Error"]
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testNumArgs'),
+smalltalk.method({
+selector: unescape('testNumArgs'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return nil;}), "_numArgs", []), (0)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return nil;}), "_numArgs", []), (2)]);
+return self;},
+args: [],
+source: unescape('testNumArgs%0A%09self%20assert%3A%20%5B%5D%20numArgs%20equals%3A%200.%0A%09self%20assert%3A%20%5B%3Aa%20%3Ab%20%7C%20%5D%20numArgs%20equals%3A%202'),
+messageSends: ["assert:equals:", "numArgs"],
+referencedClasses: []
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testValueWithPossibleArguments'),
+smalltalk.method({
+selector: unescape('testValueWithPossibleArguments'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1);}), "_valueWithPossibleArguments_", [[(3), (4)]]), (1)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +(4) : smalltalk.send($receiver, "__plus", [(4)]));}), "_valueWithPossibleArguments_", [[(3), (4)]]), (7)]);
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(a, b){return ((($receiver = a).klass === smalltalk.Number) ? $receiver +b : smalltalk.send($receiver, "__plus", [b]));}), "_valueWithPossibleArguments_", [[(3), (4), (5)]]), (7)]);
+return self;},
+args: [],
+source: unescape('testValueWithPossibleArguments%0A%09self%20assert%3A%20%28%5B1%5D%20valueWithPossibleArguments%3A%20%23%283%204%29%29%20equals%3A%201.%0A%09self%20assert%3A%20%28%5B%3Aa%20%7C%20a%20+%204%5D%20valueWithPossibleArguments%3A%20%23%283%204%29%29%20equals%3A%207.%0A%09self%20assert%3A%20%28%5B%3Aa%20%3Ab%20%7C%20a%20+%20b%5D%20valueWithPossibleArguments%3A%20%23%283%204%205%29%29%20equals%3A%207.'),
+messageSends: ["assert:equals:", "valueWithPossibleArguments:", unescape("+")],
+referencedClasses: []
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testWhileTrue'),
+smalltalk.method({
+selector: unescape('testWhileTrue'),
+category: 'tests',
+fn: function (){
+var self=this;
+var i=nil;
+i=(0);
+(function(){while((function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
+smalltalk.send(self, "_assert_equals_", [i, (5)]);
+i=(0);
+(function(){while((function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver <(5) : smalltalk.send($receiver, "__lt", [(5)]));})()) {}})();
+smalltalk.send(self, "_assert_equals_", [i, (5)]);
+return self;},
+args: [],
+source: unescape('testWhileTrue%0A%09%7C%20i%20%7C%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3C%205%5D%20whileTrue%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%205.%0A%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3A%3D%20i%20+%201.%20i%20%3C%205%5D%20whileTrue.%0A%09self%20assert%3A%20i%20equals%3A%205'),
+messageSends: ["whileTrue:", unescape("%3C"), unescape("+"), "assert:equals:", "whileTrue"],
+referencedClasses: []
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testWhileFalse'),
+smalltalk.method({
+selector: unescape('testWhileFalse'),
+category: 'tests',
+fn: function (){
+var self=this;
+var i=nil;
+i=(0);
+(function(){while(!(function(){return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {(function(){return i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));})()}})();
+smalltalk.send(self, "_assert_equals_", [i, (6)]);
+i=(0);
+(function(){while(!(function(){i=((($receiver = i).klass === smalltalk.Number) ? $receiver +(1) : smalltalk.send($receiver, "__plus", [(1)]));return ((($receiver = i).klass === smalltalk.Number) ? $receiver >(5) : smalltalk.send($receiver, "__gt", [(5)]));})()) {}})();
+smalltalk.send(self, "_assert_equals_", [i, (6)]);
+return self;},
+args: [],
+source: unescape('testWhileFalse%0A%09%7C%20i%20%7C%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3E%205%5D%20whileFalse%3A%20%5Bi%20%3A%3D%20i%20+%201%5D.%0A%09self%20assert%3A%20i%20equals%3A%206.%0A%0A%09i%20%3A%3D%200.%0A%09%5Bi%20%3A%3D%20i%20+%201.%20i%20%3E%205%5D%20whileFalse.%0A%09self%20assert%3A%20i%20equals%3A%206'),
+messageSends: ["whileFalse:", unescape("%3E"), unescape("+"), "assert:equals:", "whileFalse"],
+referencedClasses: []
+}),
+smalltalk.BlockClosureTest);
+
+smalltalk.addMethod(
+unescape('_testCompiledSource'),
+smalltalk.method({
+selector: unescape('testCompiledSource'),
+category: 'tests',
+fn: function (){
+var self=this;
+smalltalk.send(self, "_assert_equals_", [smalltalk.send((function(){return (1) + (1);}), "_compiledSource", []), unescape("function%20%28%29%7Breturn%20%281%29%20+%20%281%29%3B%7D")]);
+return self;},
+args: [],
+source: unescape('testCompiledSource%0A%09self%20assert%3A%20%5B1+1%5D%20compiledSource%20equals%3A%20%20%27function%20%28%29%7Breturn%20%281%29%20+%20%281%29%3B%7D%27%20'),
+messageSends: ["assert:equals:", "compiledSource", unescape("+")],
+referencedClasses: []
+}),
+smalltalk.BlockClosureTest);
+
+
+
+smalltalk.addClass('ObjectTest', smalltalk.TestCase, [], 'Kernel-Tests');
+smalltalk.addMethod(
+unescape('_testEquality'),
+smalltalk.method({
+selector: unescape('testEquality'),
+category: 'tests',
+fn: function (){
+var self=this;
+var o=nil;
+o=smalltalk.send((smalltalk.Object || Object), "_new", []);
+smalltalk.send(self, "_deny_", [smalltalk.send(o, "__eq", [smalltalk.send((smalltalk.Object || Object), "_new", [])])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [o])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(smalltalk.send(o, "_yourself", []), "__eq", [o])]);
+smalltalk.send(self, "_assert_", [smalltalk.send(o, "__eq", [smalltalk.send(o, "_yourself", [])])]);
+return self;},
+args: [],
+source: unescape('testEquality%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09self%20deny%3A%20o%20%3D%20Object%20new.%0A%09self%20assert%3A%20o%20%3D%20o.%0A%09self%20assert%3A%20o%20yourself%20%3D%20o.%0A%09self%20assert%3A%20o%20%3D%20o%20yourself'),
+messageSends: ["new", "deny:", unescape("%3D"), "assert:", "yourself"],
+referencedClasses: ["Object"]
+}),
+smalltalk.ObjectTest);
+
+smalltalk.addMethod(
+unescape('_testIdentity'),
+smalltalk.method({
+selector: unescape('testIdentity'),
+category: 'tests',
+fn: function (){
+var self=this;
+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])]);
+return self;},
+args: [],
+source: unescape('testIdentity%0A%09%7C%20o%20%7C%0A%09o%20%3A%3D%20Object%20new.%0A%09self%20deny%3A%20o%20%3D%3D%20Object%20new.%0A%09self%20assert%3A%20o%20%3D%3D%20o'),
+messageSends: ["new", "deny:", unescape("%3D%3D"), "assert:"],
+referencedClasses: ["Object"]
+}),
+smalltalk.ObjectTest);
+
+
+

+ 6 - 1
st/Kernel-Methods.st

@@ -56,6 +56,11 @@ arguments
 Object subclass: #BlockClosure
 	instanceVariableNames: ''
 	category: 'Kernel-Methods'!
+!BlockClosure commentStamp!
+A BlockClosure is a lexical closure.
+The JavaScript representation is a function.
+
+A BlockClosure is evaluated with the #value* methods in the 'evaluating' protocol.!
 
 !BlockClosure methodsFor: 'accessing'!
 
@@ -143,7 +148,7 @@ timeToRun
 ensure: aBlock
 	| success |
 	success := false.
-	[self value. success := true. aBlock value]
+	^[self value. success := true. aBlock value]
 		on: Error
 		do: [:ex |
 			success ifFalse: [aBlock value].

+ 145 - 3
st/Kernel-Tests.st

@@ -144,7 +144,7 @@ TestCase subclass: #BooleanTest
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 
-!BooleanTest methodsFor: 'not yet classified'!
+!BooleanTest methodsFor: 'tests'!
 
 testLogic
  
@@ -212,6 +212,15 @@ testIfTrueIfFalse
 
 	self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block'.
 	self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block2'.
+!
+
+testIdentity
+	self assert: true == true.
+	self assert: true yourself == true.
+	self assert: true == true yourself.
+	self assert: true yourself == true yourself.
+
+	self deny: true == false
 ! !
 
 TestCase subclass: #NumberTest
@@ -302,8 +311,58 @@ testTruncated
 !
 
 testCopying
-	self assert: 1 copy = 1.
-	self assert: 1 deepCopy = 1
+	self assert: 1 copy == 1.
+	self assert: 1 deepCopy == 1
+!
+
+testMinMax
+	
+	self assert: (2 max: 5) equals: 5.
+	self assert: (2 min: 5) equals: 2
+!
+
+testIdentity
+	self assert: 1 == 1.
+	self assert: 0 == 0.
+	self deny: 1 == 0.
+
+	self assert: 1 yourself == 1.
+	self assert: 1 == 1 yourself.
+	self assert: 1 yourself == 1 yourself.
+	
+	self deny: 1 == 2
+!
+
+testSqrt
+	
+	self assert: 4 sqrt = 2.
+	self assert: 16 sqrt = 4
+!
+
+testSquared
+	
+	self assert: 4 squared = 16
+!
+
+testTimesRepeat
+	| i |
+
+	i := 0.
+	0 timesRepeat: [i := i + 1].
+	self assert: i equals: 0.
+
+	5 timesRepeat: [i := i + 1].
+	self assert: i equals: 5
+!
+
+testTo
+	self assert: (1 to: 5) equals: #(1 2 3 4 5)
+!
+
+testToBy
+	self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).
+
+	self should: [1 to: 4 by: 0] raise: Error
 ! !
 
 TestCase subclass: #JSObjectProxyTest
@@ -424,3 +483,86 @@ shouldInheritSelectors
 	^ false
 ! !
 
+TestCase subclass: #BlockClosureTest
+	instanceVariableNames: ''
+	category: 'Kernel-Tests'!
+
+!BlockClosureTest methodsFor: 'tests'!
+
+testValue
+	self assert: ([1+1] value) equals: 2.
+	self assert: ([:x | x +1] value: 2) equals: 3.
+	self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8. 
+
+	"Arguments are optional in Amber. This isn't ANSI compliant."
+
+	self assert: ([:a :b :c | 1] value) equals: 1
+!
+
+testOnDo
+	self assert: ([Error new signal] on: Error do: [:ex | true])
+!
+
+testEnsure
+	self assert: ([Error new] ensure: [true])
+!
+
+testNumArgs
+	self assert: [] numArgs equals: 0.
+	self assert: [:a :b | ] numArgs equals: 2
+!
+
+testValueWithPossibleArguments
+	self assert: ([1] valueWithPossibleArguments: #(3 4)) equals: 1.
+	self assert: ([:a | a + 4] valueWithPossibleArguments: #(3 4)) equals: 7.
+	self assert: ([:a :b | a + b] valueWithPossibleArguments: #(3 4 5)) equals: 7.
+!
+
+testWhileTrue
+	| i |
+	i := 0.
+	[i < 5] whileTrue: [i := i + 1].
+	self assert: i equals: 5.
+
+	i := 0.
+	[i := i + 1. i < 5] whileTrue.
+	self assert: i equals: 5
+!
+
+testWhileFalse
+	| i |
+	i := 0.
+	[i > 5] whileFalse: [i := i + 1].
+	self assert: i equals: 6.
+
+	i := 0.
+	[i := i + 1. i > 5] whileFalse.
+	self assert: i equals: 6
+!
+
+testCompiledSource
+	self assert: [1+1] compiledSource equals:  'function (){return (1) + (1);}'
+! !
+
+TestCase subclass: #ObjectTest
+	instanceVariableNames: ''
+	category: 'Kernel-Tests'!
+
+!ObjectTest methodsFor: 'tests'!
+
+testEquality
+	| o |
+	o := Object new.
+	self deny: o = Object new.
+	self assert: o = o.
+	self assert: o yourself = o.
+	self assert: o = o yourself
+!
+
+testIdentity
+	| o |
+	o := Object new.
+	self deny: o == Object new.
+	self assert: o == o
+! !
+