Browse Source

Merge pull request #156 from dalehenrich/Issue147

fix for Issue #147
Nicolas Petton 13 years ago
parent
commit
165fc187c0
6 changed files with 1764 additions and 1643 deletions
  1. 96 95
      js/Kernel-Collections.deploy.js
  2. 133 132
      js/Kernel-Collections.js
  3. 358 327
      js/Kernel-Tests.deploy.js
  4. 506 455
      js/Kernel-Tests.js
  5. 59 58
      st/Kernel-Collections.st
  6. 612 576
      st/Kernel-Tests.st

+ 96 - 95
js/Kernel-Collections.deploy.js

@@ -1,86 +1,4 @@
 smalltalk.addPackage('Kernel-Collections', {});
 smalltalk.addPackage('Kernel-Collections', {});
-smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
-smalltalk.addMethod(
-unescape('__eq'),
-smalltalk.method({
-selector: unescape('%3D'),
-fn: function (anAssociation) {
-var self=this;
-return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
-return self;}
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_key_'),
-smalltalk.method({
-selector: unescape('key%3A'),
-fn: function (aKey) {
-var self=this;
-(self['@key']=aKey);
-return self;}
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_key'),
-smalltalk.method({
-selector: unescape('key'),
-fn: function () {
-var self=this;
-return self['@key'];
-return self;}
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_value_'),
-smalltalk.method({
-selector: unescape('value%3A'),
-fn: function (aValue) {
-var self=this;
-(self['@value']=aValue);
-return self;}
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_value'),
-smalltalk.method({
-selector: unescape('value'),
-fn: function () {
-var self=this;
-return self['@value'];
-return self;}
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_storeOn_'),
-smalltalk.method({
-selector: unescape('storeOn%3A'),
-fn: function (aStream) {
-var self=this;
-smalltalk.send(self['@key'], "_storeOn_", [aStream]);
-smalltalk.send(aStream, "_nextPutAll_", [unescape("-%3E")]);
-smalltalk.send(self['@value'], "_storeOn_", [aStream]);
-return self;}
-}),
-smalltalk.Association);
-
-
-smalltalk.addMethod(
-unescape('_key_value_'),
-smalltalk.method({
-selector: unescape('key%3Avalue%3A'),
-fn: function (aKey, aValue) {
-var self=this;
-return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
-return self;}
-}),
-smalltalk.Association.klass);
-
-
 smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
 smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
 smalltalk.addMethod(
 smalltalk.addMethod(
 unescape('_collection'),
 unescape('_collection'),
@@ -354,6 +272,88 @@ return self;}
 smalltalk.Stream.klass);
 smalltalk.Stream.klass);
 
 
 
 
+smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
+smalltalk.addMethod(
+unescape('__eq'),
+smalltalk.method({
+selector: unescape('%3D'),
+fn: function (anAssociation) {
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
+return self;}
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_key_'),
+smalltalk.method({
+selector: unescape('key%3A'),
+fn: function (aKey) {
+var self=this;
+(self['@key']=aKey);
+return self;}
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_key'),
+smalltalk.method({
+selector: unescape('key'),
+fn: function () {
+var self=this;
+return self['@key'];
+return self;}
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_value_'),
+smalltalk.method({
+selector: unescape('value%3A'),
+fn: function (aValue) {
+var self=this;
+(self['@value']=aValue);
+return self;}
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_value'),
+smalltalk.method({
+selector: unescape('value'),
+fn: function () {
+var self=this;
+return self['@value'];
+return self;}
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_storeOn_'),
+smalltalk.method({
+selector: unescape('storeOn%3A'),
+fn: function (aStream) {
+var self=this;
+smalltalk.send(self['@key'], "_storeOn_", [aStream]);
+smalltalk.send(aStream, "_nextPutAll_", [unescape("-%3E")]);
+smalltalk.send(self['@value'], "_storeOn_", [aStream]);
+return self;}
+}),
+smalltalk.Association);
+
+
+smalltalk.addMethod(
+unescape('_key_value_'),
+smalltalk.method({
+selector: unescape('key%3Avalue%3A'),
+fn: function (aKey, aValue) {
+var self=this;
+return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
+return self;}
+}),
+smalltalk.Association.klass);
+
+
 smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
 smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
 smalltalk.addMethod(
 smalltalk.addMethod(
 unescape('_compile_'),
 unescape('_compile_'),
@@ -2933,9 +2933,9 @@ smalltalk.addMethod(
 unescape('_removeKey_'),
 unescape('_removeKey_'),
 smalltalk.method({
 smalltalk.method({
 selector: unescape('removeKey%3A'),
 selector: unescape('removeKey%3A'),
-fn: function (aKey) {
+fn: function (aKey){
 var self=this;
 var self=this;
-smalltalk.send(self, "_remove_", [aKey]);
+return smalltalk.send(self, "_remove_", [aKey]);
 return self;}
 return self;}
 }),
 }),
 smalltalk.HashedCollection);
 smalltalk.HashedCollection);
@@ -3254,17 +3254,18 @@ smalltalk.addMethod(
 unescape('_removeKey_ifAbsent_'),
 unescape('_removeKey_ifAbsent_'),
 smalltalk.method({
 smalltalk.method({
 selector: unescape('removeKey%3AifAbsent%3A'),
 selector: unescape('removeKey%3AifAbsent%3A'),
-fn: function (aKey, aBlock) {
+fn: function (aKey, aBlock){
-var self=this;
+var self=this;
-
+
-		var index = self['@keys'].indexOf(aKey);
+    		var index = self['@keys'].indexOf(aKey);
-		if(index === -1) {
+    		if(index === -1) {
-			return aBlock()
+        		return aBlock()
-		} else {
+    		} else {
-			self['@keys'].splice(i, 1);
+        		var value;
-			self['@values'].splice(i, 1);
+        		self['@keys'].splice(index, 1);
-			return aKey
+        		value = self['@values'].splice(index, 1);
-		};
+       			return value[0];
+    		};
 	;
 	;
 return self;}
 return self;}
 }),
 }),

+ 133 - 132
js/Kernel-Collections.js

@@ -1,121 +1,4 @@
 smalltalk.addPackage('Kernel-Collections', {});
 smalltalk.addPackage('Kernel-Collections', {});
-smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
-smalltalk.addMethod(
-unescape('__eq'),
-smalltalk.method({
-selector: unescape('%3D'),
-category: 'comparing',
-fn: function (anAssociation) {
-var self=this;
-return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
-return self;},
-args: ["anAssociation"],
-source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D'),
-messageSends: ["and:", unescape("%3D"), "class", "key", "value"],
-referencedClasses: []
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_key_'),
-smalltalk.method({
-selector: unescape('key%3A'),
-category: 'accessing',
-fn: function (aKey) {
-var self=this;
-(self['@key']=aKey);
-return self;},
-args: ["aKey"],
-source: unescape('key%3A%20aKey%0A%09key%20%3A%3D%20aKey'),
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_key'),
-smalltalk.method({
-selector: unescape('key'),
-category: 'accessing',
-fn: function () {
-var self=this;
-return self['@key'];
-return self;},
-args: [],
-source: unescape('key%0A%09%5Ekey'),
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_value_'),
-smalltalk.method({
-selector: unescape('value%3A'),
-category: 'accessing',
-fn: function (aValue) {
-var self=this;
-(self['@value']=aValue);
-return self;},
-args: ["aValue"],
-source: unescape('value%3A%20aValue%0A%09value%20%3A%3D%20aValue'),
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_value'),
-smalltalk.method({
-selector: unescape('value'),
-category: 'accessing',
-fn: function () {
-var self=this;
-return self['@value'];
-return self;},
-args: [],
-source: unescape('value%0A%09%5Evalue'),
-messageSends: [],
-referencedClasses: []
-}),
-smalltalk.Association);
-
-smalltalk.addMethod(
-unescape('_storeOn_'),
-smalltalk.method({
-selector: unescape('storeOn%3A'),
-category: 'comparing',
-fn: function (aStream) {
-var self=this;
-smalltalk.send(self['@key'], "_storeOn_", [aStream]);
-smalltalk.send(aStream, "_nextPutAll_", [unescape("-%3E")]);
-smalltalk.send(self['@value'], "_storeOn_", [aStream]);
-return self;},
-args: ["aStream"],
-source: unescape('storeOn%3A%20aStream%0A%09%22Store%20in%20the%20format%20%28key-%3Evalue%29%22%0A%0A%09%22aStream%20nextPutAll%3A%20%27%28%27.%22%0A%09key%20storeOn%3A%20aStream.%0A%09aStream%20nextPutAll%3A%20%27-%3E%27.%0A%09value%20storeOn%3A%20aStream.%0A%09%22aStream%20nextPutAll%3A%20%27%29%27%22'),
-messageSends: ["storeOn:", "nextPutAll:"],
-referencedClasses: []
-}),
-smalltalk.Association);
-
-
-smalltalk.addMethod(
-unescape('_key_value_'),
-smalltalk.method({
-selector: unescape('key%3Avalue%3A'),
-category: 'instance creation',
-fn: function (aKey, aValue) {
-var self=this;
-return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
-return self;},
-args: ["aKey", "aValue"],
-source: unescape('key%3A%20aKey%20value%3A%20aValue%0A%09%20%20%20%20%5Eself%20new%0A%09%09key%3A%20aKey%3B%0A%09%09value%3A%20aValue%3B%0A%09%09yourself'),
-messageSends: ["key:", "value:", "yourself", "new"],
-referencedClasses: []
-}),
-smalltalk.Association.klass);
-
-
 smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
 smalltalk.addClass('Stream', smalltalk.Object, ['collection', 'position', 'streamSize'], 'Kernel-Collections');
 smalltalk.addMethod(
 smalltalk.addMethod(
 unescape('_collection'),
 unescape('_collection'),
@@ -509,6 +392,123 @@ referencedClasses: []
 smalltalk.Stream.klass);
 smalltalk.Stream.klass);
 
 
 
 
+smalltalk.addClass('Association', smalltalk.Object, ['key', 'value'], 'Kernel-Collections');
+smalltalk.addMethod(
+unescape('__eq'),
+smalltalk.method({
+selector: unescape('%3D'),
+category: 'comparing',
+fn: function (anAssociation) {
+var self=this;
+return smalltalk.send(smalltalk.send(smalltalk.send(self, "_class", []), "__eq", [smalltalk.send(anAssociation, "_class", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(self, "_key", []), "__eq", [smalltalk.send(anAssociation, "_key", [])]), "_and_", [(function(){return smalltalk.send(smalltalk.send(self, "_value", []), "__eq", [smalltalk.send(anAssociation, "_value", [])]);})]);})]);
+return self;},
+args: ["anAssociation"],
+source: unescape('%3D%20anAssociation%0A%09%5Eself%20class%20%3D%20anAssociation%20class%20and%3A%20%5B%0A%09%20%20%20%20self%20key%20%3D%20anAssociation%20key%20and%3A%20%5B%0A%09%09self%20value%20%3D%20anAssociation%20value%5D%5D'),
+messageSends: ["and:", unescape("%3D"), "class", "key", "value"],
+referencedClasses: []
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_key_'),
+smalltalk.method({
+selector: unescape('key%3A'),
+category: 'accessing',
+fn: function (aKey) {
+var self=this;
+(self['@key']=aKey);
+return self;},
+args: ["aKey"],
+source: unescape('key%3A%20aKey%0A%09key%20%3A%3D%20aKey'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_key'),
+smalltalk.method({
+selector: unescape('key'),
+category: 'accessing',
+fn: function () {
+var self=this;
+return self['@key'];
+return self;},
+args: [],
+source: unescape('key%0A%09%5Ekey'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_value_'),
+smalltalk.method({
+selector: unescape('value%3A'),
+category: 'accessing',
+fn: function (aValue) {
+var self=this;
+(self['@value']=aValue);
+return self;},
+args: ["aValue"],
+source: unescape('value%3A%20aValue%0A%09value%20%3A%3D%20aValue'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_value'),
+smalltalk.method({
+selector: unescape('value'),
+category: 'accessing',
+fn: function () {
+var self=this;
+return self['@value'];
+return self;},
+args: [],
+source: unescape('value%0A%09%5Evalue'),
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.Association);
+
+smalltalk.addMethod(
+unescape('_storeOn_'),
+smalltalk.method({
+selector: unescape('storeOn%3A'),
+category: 'comparing',
+fn: function (aStream) {
+var self=this;
+smalltalk.send(self['@key'], "_storeOn_", [aStream]);
+smalltalk.send(aStream, "_nextPutAll_", [unescape("-%3E")]);
+smalltalk.send(self['@value'], "_storeOn_", [aStream]);
+return self;},
+args: ["aStream"],
+source: unescape('storeOn%3A%20aStream%0A%09%22Store%20in%20the%20format%20%28key-%3Evalue%29%22%0A%0A%09%22aStream%20nextPutAll%3A%20%27%28%27.%22%0A%09key%20storeOn%3A%20aStream.%0A%09aStream%20nextPutAll%3A%20%27-%3E%27.%0A%09value%20storeOn%3A%20aStream.%0A%09%22aStream%20nextPutAll%3A%20%27%29%27%22'),
+messageSends: ["storeOn:", "nextPutAll:"],
+referencedClasses: []
+}),
+smalltalk.Association);
+
+
+smalltalk.addMethod(
+unescape('_key_value_'),
+smalltalk.method({
+selector: unescape('key%3Avalue%3A'),
+category: 'instance creation',
+fn: function (aKey, aValue) {
+var self=this;
+return (function($rec){smalltalk.send($rec, "_key_", [aKey]);smalltalk.send($rec, "_value_", [aValue]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
+return self;},
+args: ["aKey", "aValue"],
+source: unescape('key%3A%20aKey%20value%3A%20aValue%0A%09%20%20%20%20%5Eself%20new%0A%09%09key%3A%20aKey%3B%0A%09%09value%3A%20aValue%3B%0A%09%09yourself'),
+messageSends: ["key:", "value:", "yourself", "new"],
+referencedClasses: []
+}),
+smalltalk.Association.klass);
+
+
 smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
 smalltalk.addClass('RegularExpression', smalltalk.Object, [], 'Kernel-Collections');
 smalltalk.addMethod(
 smalltalk.addMethod(
 unescape('_compile_'),
 unescape('_compile_'),
@@ -4170,12 +4170,12 @@ unescape('_removeKey_'),
 smalltalk.method({
 smalltalk.method({
 selector: unescape('removeKey%3A'),
 selector: unescape('removeKey%3A'),
 category: 'adding/removing',
 category: 'adding/removing',
-fn: function (aKey) {
+fn: function (aKey){
 var self=this;
 var self=this;
-smalltalk.send(self, "_remove_", [aKey]);
+return smalltalk.send(self, "_remove_", [aKey]);
 return self;},
 return self;},
 args: ["aKey"],
 args: ["aKey"],
-source: unescape('removeKey%3A%20aKey%0A%20%20%20%20self%20remove%3A%20aKey'),
+source: unescape('removeKey%3A%20aKey%0A%20%20%20%20%5Eself%20remove%3A%20aKey'),
 messageSends: ["remove:"],
 messageSends: ["remove:"],
 referencedClasses: []
 referencedClasses: []
 }),
 }),
@@ -4616,21 +4616,22 @@ unescape('_removeKey_ifAbsent_'),
 smalltalk.method({
 smalltalk.method({
 selector: unescape('removeKey%3AifAbsent%3A'),
 selector: unescape('removeKey%3AifAbsent%3A'),
 category: 'adding/removing',
 category: 'adding/removing',
-fn: function (aKey, aBlock) {
+fn: function (aKey, aBlock){
-var self=this;
+var self=this;
-
+
-		var index = self['@keys'].indexOf(aKey);
+    		var index = self['@keys'].indexOf(aKey);
-		if(index === -1) {
+    		if(index === -1) {
-			return aBlock()
+        		return aBlock()
-		} else {
+    		} else {
-			self['@keys'].splice(i, 1);
+        		var value;
-			self['@values'].splice(i, 1);
+        		self['@keys'].splice(index, 1);
-			return aKey
+        		value = self['@values'].splice(index, 1);
-		};
+       			return value[0];
+    		};
 	;
 	;
 return self;},
 return self;},
 args: ["aKey", "aBlock"],
 args: ["aKey", "aBlock"],
-source: unescape('removeKey%3A%20aKey%20ifAbsent%3A%20aBlock%0A%09%3C%0A%09%09var%20index%20%3D%20self%5B%27@keys%27%5D.indexOf%28aKey%29%3B%0A%09%09if%28index%20%3D%3D%3D%20-1%29%20%7B%0A%09%09%09return%20aBlock%28%29%0A%09%09%7D%20else%20%7B%0A%09%09%09self%5B%27@keys%27%5D.splice%28i%2C%201%29%3B%0A%09%09%09self%5B%27@values%27%5D.splice%28i%2C%201%29%3B%0A%09%09%09return%20aKey%0A%09%09%7D%3B%0A%09%3E'),
+source: unescape('removeKey%3A%20aKey%20ifAbsent%3A%20aBlock%0A%09%3C%0A%20%20%20%20%09%09var%20index%20%3D%20self%5B%27@keys%27%5D.indexOf%28aKey%29%3B%0A%20%20%20%20%09%09if%28index%20%3D%3D%3D%20-1%29%20%7B%0A%20%20%20%20%20%20%20%20%09%09return%20aBlock%28%29%0A%20%20%20%20%09%09%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20%09%09var%20value%3B%0A%20%20%20%20%20%20%20%20%09%09self%5B%27@keys%27%5D.splice%28index%2C%201%29%3B%0A%20%20%20%20%20%20%20%20%09%09value%20%3D%20self%5B%27@values%27%5D.splice%28index%2C%201%29%3B%0A%20%20%20%20%20%20%20%09%09%09return%20value%5B0%5D%3B%0A%20%20%20%20%09%09%7D%3B%0A%09%3E'),
 messageSends: [],
 messageSends: [],
 referencedClasses: []
 referencedClasses: []
 }),
 }),

File diff suppressed because it is too large
+ 358 - 327
js/Kernel-Tests.deploy.js


File diff suppressed because it is too large
+ 506 - 455
js/Kernel-Tests.js


+ 59 - 58
st/Kernel-Collections.st

@@ -1,53 +1,4 @@
 Smalltalk current createPackage: 'Kernel-Collections' properties: #{}!
 Smalltalk current createPackage: 'Kernel-Collections' properties: #{}!
-Object subclass: #Association
-	instanceVariableNames: 'key value'
-	category: 'Kernel-Collections'!
-
-!Association methodsFor: 'accessing'!
-
-key: aKey
-	key := aKey
-!
-
-key
-	^key
-!
-
-value: aValue
-	value := aValue
-!
-
-value
-	^value
-! !
-
-!Association methodsFor: 'comparing'!
-
-= anAssociation
-	^self class = anAssociation class and: [
-	    self key = anAssociation key and: [
-		self value = anAssociation value]]
-!
-
-storeOn: aStream
-	"Store in the format (key->value)"
-
-	"aStream nextPutAll: '('."
-	key storeOn: aStream.
-	aStream nextPutAll: '->'.
-	value storeOn: aStream.
-	"aStream nextPutAll: ')'"
-! !
-
-!Association class methodsFor: 'instance creation'!
-
-key: aKey value: aValue
-	    ^self new
-		key: aKey;
-		value: aValue;
-		yourself
-! !
-
 Object subclass: #Stream
 Object subclass: #Stream
 	instanceVariableNames: 'collection position streamSize'
 	instanceVariableNames: 'collection position streamSize'
 	category: 'Kernel-Collections'!
 	category: 'Kernel-Collections'!
@@ -181,6 +132,55 @@ on: aCollection
 		yourself
 		yourself
 ! !
 ! !
 
 
+Object subclass: #Association
+	instanceVariableNames: 'key value'
+	category: 'Kernel-Collections'!
+
+!Association methodsFor: 'accessing'!
+
+key: aKey
+	key := aKey
+!
+
+key
+	^key
+!
+
+value: aValue
+	value := aValue
+!
+
+value
+	^value
+! !
+
+!Association methodsFor: 'comparing'!
+
+= anAssociation
+	^self class = anAssociation class and: [
+	    self key = anAssociation key and: [
+		self value = anAssociation value]]
+!
+
+storeOn: aStream
+	"Store in the format (key->value)"
+
+	"aStream nextPutAll: '('."
+	key storeOn: aStream.
+	aStream nextPutAll: '->'.
+	value storeOn: aStream.
+	"aStream nextPutAll: ')'"
+! !
+
+!Association class methodsFor: 'instance creation'!
+
+key: aKey value: aValue
+	    ^self new
+		key: aKey;
+		value: aValue;
+		yourself
+! !
+
 Object subclass: #RegularExpression
 Object subclass: #RegularExpression
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Collections'!
 	category: 'Kernel-Collections'!
@@ -1494,7 +1494,7 @@ addAll: aHashedCollection
 !
 !
 
 
 removeKey: aKey
 removeKey: aKey
-    self remove: aKey
+    ^self remove: aKey
 !
 !
 
 
 remove: aKey ifAbsent: aBlock
 remove: aKey ifAbsent: aBlock
@@ -1680,14 +1680,15 @@ at: aKey put: aValue
 
 
 removeKey: aKey ifAbsent: aBlock
 removeKey: aKey ifAbsent: aBlock
 	<
 	<
-		var index = self['@keys'].indexOf(aKey);
+    		var index = self['@keys'].indexOf(aKey);
-		if(index === -1) {
+    		if(index === -1) {
-			return aBlock()
+        		return aBlock()
-		} else {
+    		} else {
-			self['@keys'].splice(i, 1);
+        		var value;
-			self['@values'].splice(i, 1);
+        		self['@keys'].splice(index, 1);
-			return aKey
+        		value = self['@values'].splice(index, 1);
-		};
+       			return value[0];
+    		};
 	>
 	>
 ! !
 ! !
 
 

+ 612 - 576
st/Kernel-Tests.st

@@ -1,444 +1,394 @@
 Smalltalk current createPackage: 'Kernel-Tests' properties: #{}!
 Smalltalk current createPackage: 'Kernel-Tests' properties: #{}!
-TestCase subclass: #ArrayTest
+TestCase subclass: #SetTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!ArrayTest methodsFor: 'testing'!
+!SetTest methodsFor: 'tests'!
-
-testFirstN
-	self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).
-!
-
-testIfEmpty
-	self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )
-! !
 
 
-TestCase subclass: #StringTest
+testUnicity
-	instanceVariableNames: ''
+	| set |
-	category: 'Kernel-Tests'!
+	set := Set new.
+	set add: 21.
+	set add: 'hello'.
 
 
-!StringTest methodsFor: 'tests'!
+	set add: 21.
+	self assert: set size = 2.
+	
+	set add: 'hello'.
+	self assert: set size = 2.
 
 
-testJoin
+	self assert: set asArray equals: #(21 'hello')
-	self assert: 'hello,world' equals: (',' join: #('hello' 'world'))
 !
 !
 
 
-testStreamContents
+testAt
-	self 
+	self should: [Set new at: 1 put: 2] raise: Error
-		assert: 'hello world' 
-		equals: (String streamContents: [:aStream| aStream 
-                                                 					nextPutAll: 'hello'; space; 
-                                                 					nextPutAll: 'world'])
 !
 !
 
 
-testIncludesSubString
+testAddRemove
-	self assert: ('amber' includesSubString: 'ber').
+	| set |
-	self deny: ('amber' includesSubString: 'zork').
+	set := Set new.
-!
+	
+	self assert: set isEmpty.
 
 
-testEquality
+	set add: 3.
-	self assert: 'hello' = 'hello'.
+	self assert: (set includes: 3).
-	self deny: 'hello' = 'world'.
 
 
-	self assert: 'hello'  = 'hello' yourself.
+	set add: 5.
-	self assert: 'hello' yourself = 'hello'.
+	self assert: (set includes: 5).
 
 
-	"test JS falsy value"
+	set remove: 3.
-	self deny: '' = 0
+	self deny: (set includes: 3)
 !
 !
 
 
-testCopyWithoutAll
+testSize
-	self 
+	self assert: Set new size equals: 0.
-		assert: 'hello world' 
+	self assert: (Set withAll: #(1 2 3 4)) size equals: 4.
-		equals: ('*hello* *world*' copyWithoutAll: '*')
+	self assert: (Set withAll: #(1 1 1 1)) size equals: 1
-!
+! !
 
 
-testAt
+TestCase subclass: #ClassBuilderTest
-	self assert: ('hello' at: 1) = 'h'.
+	instanceVariableNames: 'builder theClass'
-	self assert: ('hello' at: 5) = 'o'.
+	category: 'Kernel-Tests'!
-	self assert: ('hello' at: 6 ifAbsent: [nil]) = nil
-!
 
 
-testAtPut
+!ClassBuilderTest methodsFor: 'running'!
-	"String instances are read-only"
+
-	self should: ['hello' at: 1 put: 'a'] raise: Error
+setUp
+	builder := ClassBuilder new
 !
 !
 
 
-testSize
+tearDown
-	self assert: 'smalltalk' size equals: 9.
+	theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]
-	self assert: '' size equals: 0
 !
 !
 
 
-testAddRemove
+testClassCopy
-	self should: ['hello' add: 'a'] raise: Error.
+	theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.
-	self should: ['hello' remove: 'h'] raise: Error
+	self assert: theClass superclass == ObjectMock superclass.
+	self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.
+	self assert: theClass name equals: 'ObjectMock2'.
+	self assert: theClass package == ObjectMock package.
+	self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys
 !
 !
 
 
-testAsArray
+testInstanceVariableNames
-	self assert: 'hello' asArray = #('h' 'e' 'l' 'l' 'o').
+	self assert: (builder instanceVariableNamesFor: '  hello   world   ') equals: #('hello' 'world')
 ! !
 ! !
 
 
-TestCase subclass: #DictionaryTest
+TestCase subclass: #RandomTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!DictionaryTest methodsFor: 'tests'!
+!RandomTest methodsFor: 'tests'!
 
 
-testPrintString
+textNext
-	self
-		assert: 'a Dictionary(''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')' 
-		equals: (Dictionary new 
-                         	at:'firstname' put: 'James';
-                        	at:'lastname' put: 'Bond';
-                        	printString)
-!
 
 
-testEquality
+	10000 timesRepeat: [
-	| d1 d2 |
+			| current next | 
+			next := Random new next.
+			self assert: (next >= 0).
+			self assert: (next < 1).
+			self deny: current = next.
+			next = current]
+! !
 
 
-	self assert: Dictionary new = Dictionary new.
+TestCase subclass: #PointTest
-		
+	instanceVariableNames: ''
-	d1 := Dictionary new at: 1 put: 2; yourself.
+	category: 'Kernel-Tests'!
-	d2 := Dictionary new at: 1 put: 2; yourself.
-	self assert: d1 = d2.
 
 
-	d2 := Dictionary new at: 1 put: 3; yourself.
+!PointTest methodsFor: 'tests'!
-	self deny: d1 = d2.
 
 
-	d2 := Dictionary new at: 2 put: 2; yourself.
+testAccessing
-	self deny: d1 = d2.
+	self assert: (Point x: 3 y: 4) x equals: 3.
+	self assert: (Point x: 3 y: 4) y equals: 4.
+	self assert: (Point new x: 3) x equals: 3.
+	self assert: (Point new y: 4) y equals: 4
+!
 
 
-	d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.
+testAt
-	self deny: d1 = d2.
+	self assert: 3@4 equals: (Point x: 3 y: 4)
 !
 !
 
 
-testDynamicDictionaries
+testEgality
-	self assert: #{'hello' -> 1} asDictionary = (Dictionary with: 'hello' -> 1)
+	self assert: 3@4 = (3@4).
+	self deny: 3@5 = (3@6)
 !
 !
 
 
-testAccessing
+testArithmetic
-	| d |
+	self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).
+	self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).
+	self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).
+	self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)
+!
 
 
-	d := Dictionary new.
+testTranslateBy
+	self assert: 3@4 equals: (3@3 translateBy: 0@1).
+	self assert: 3@2 equals: (3@3 translateBy: 0@1 negated).
+	self assert: 5@6 equals: (3@3 translateBy: 2@3).
+	self assert: 0@3 equals: (3@3 translateBy: 3 negated @0).
+! !
 
 
-	d at: 'hello' put: 'world'.
+TestCase subclass: #UndefinedTest
-	self assert: (d at: 'hello') = 'world'.
+	instanceVariableNames: ''
-	self assert: (d at: 'hello' ifAbsent: [nil]) = 'world'.
+	category: 'Kernel-Tests'!
-	self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.
 
 
-	d at: 1 put: 2.
+!UndefinedTest methodsFor: 'tests'!
-	self assert: (d at: 1) = 2.
 
 
-	d at: 1@3 put: 3.
+testIsNil
-	self assert: (d at: 1@3) = 3
+	self assert: nil isNil.
+	self deny: nil notNil.
 !
 !
 
 
-testSize
+testIfNil
-	| d |
+	self assert: (nil ifNil: [true]) equals: true.
-
+	self deny: (nil ifNotNil: [true]) = true.
-	d := Dictionary new.
+	self assert: (nil ifNil: [true] ifNotNil: [false]) equals: true.
-	self assert: d size = 0.
+	self deny: (nil ifNotNil: [true] ifNil: [false]) = true
-
-	d at: 1 put: 2.
-	self assert: d size = 1.
-
-	d at: 2 put: 3.
-	self assert: d size = 2.
 !
 !
 
 
-testValues
+testCopying
-	| d |
+	self assert: nil copy equals: nil
+!
 
 
-	d := Dictionary new.
+testDeepCopy
-	d at: 1 put: 2.
+	self assert: nil deepCopy = nil
-	d at: 2 put: 3.
+! !
-	d at: 3 put: 4.
 
 
-	self assert: d values = #(2 3 4)
+Object subclass: #ObjectMock
-!
+	instanceVariableNames: 'foo bar'
+	category: 'Kernel-Tests'!
 
 
-testKeys
+!ObjectMock methodsFor: 'not yet classified'!
-	| d |
 
 
-	d := Dictionary new.
+foo
-	d at: 1 put: 2.
+	^foo
-	d at: 2 put: 3.
+!
-	d at: 3 put: 4.
 
 
-	self assert: d keys = #(1 2 3)
+foo: anObject
+	foo := anObject
 ! !
 ! !
 
 
-TestCase subclass: #BooleanTest
+TestCase subclass: #SymbolTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!BooleanTest methodsFor: 'tests'!
+!SymbolTest methodsFor: 'tests'!
-
-testLogic
- 
-	"Trivial logic table"
-	self assert: (true & true); deny: (true & false); deny: (false & true); deny: (false & false).
-	self assert: (true | true); assert: (true | false); assert: (false | true); deny: (false | false).
-        "Checking that expressions work fine too"
-	self assert: (true & (1 > 0)); deny: ((1 > 0) & false); deny: ((1 > 0) & (1 > 2)).
-        self assert: (false | (1 > 0)); assert: ((1 > 0) | false); assert: ((1 > 0) | (1 > 2))
-!
 
 
 testEquality
 testEquality
-	"We're on top of JS...just be sure to check the basics!!"
+	self assert: #hello = #hello.
+	self deny: #hello = #world.
 
 
-	self deny: 0 = false. 
+	self assert: #hello  = #hello yourself.
-	self deny: false = 0.
+	self assert: #hello yourself = #hello.
-	self deny: '' = false.
-	self deny: false = ''.
 
 
-	self assert: true = true.
+	self deny: #hello  = 'hello'.
-	self deny: false = true.
+	self deny: 'hello' = #hello.
-	self deny: true = false.
-	self assert: false = false.
-
-	"JS may do some type coercing after sending a message"
-	self assert: true yourself = true.
-	self assert: true yourself = true yourself
 !
 !
 
 
-testLogicKeywords
+testAt
- 
+	self assert: (#hello at: 1) = 'h'.
-	"Trivial logic table"
+	self assert: (#hello at: 5) = 'o'.
-	self 
+	self assert: (#hello at: 6 ifAbsent: [nil]) = nil
-		assert: (true and: [ true]); 
-		deny: (true and: [ false ]); 
-		deny: (false and: [ true ]); 
-		deny: (false and: [ false ]).
-	self 
-		assert: (true or: [ true ]); 
-		assert: (true or: [ false ]); 
-		assert: (false or: [ true ]); 
-		deny: (false or: [ false ]).
-        
-	"Checking that expressions work fine too"
-	self 
-		assert: (true and: [ 1 > 0 ]); 
-		deny: ((1 > 0) and: [ false ]); 
-		deny: ((1 > 0) and: [ 1 > 2 ]).
-        self 
-		assert: (false or: [ 1 > 0 ]); 
-		assert: ((1 > 0) or: [ false ]); 
-		assert: ((1 > 0) or: [ 1 > 2 ])
 !
 !
 
 
-testIfTrueIfFalse
+testAtPut
- 
+	"Symbol instances are read-only"
-	self assert: (true ifTrue: ['alternative block']) = 'alternative block'.
+	self should: ['hello' at: 1 put: 'a'] raise: Error
-	self assert: (true ifFalse: ['alternative block']) = nil.
+!
 
 
-	self assert: (false ifTrue: ['alternative block']) = nil.
+testIdentity
-	self assert: (false ifFalse: ['alternative block']) = 'alternative block'.
+	self assert: #hello == #hello.
+	self deny: #hello == #world.
 
 
-	self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block2'.
+	self assert: #hello  = #hello yourself.
-	self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block'.
+	self assert: #hello yourself = #hello asString asSymbol
+!
 
 
-	self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block'.
+testComparing
-	self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block2'.
+	self assert: #ab > #aa.
-! !
+	self deny: #ab > #ba.
 
 
-TestCase subclass: #NumberTest
+	self assert: #ab < #ba.
-	instanceVariableNames: ''
+	self deny: #bb < #ba.
-	category: 'Kernel-Tests'!
 
 
-!NumberTest methodsFor: 'tests'!
+	self assert: #ab >= #aa.
+	self deny: #ab >= #ba.
 
 
-testPrintShowingDecimalPlaces
+	self assert: #ab <= #ba.
-	self assert: '23.00' equals: (23 printShowingDecimalPlaces: 2).
+	self deny: #bb <= #ba
-	self assert: '23.57' equals: (23.5698 printShowingDecimalPlaces: 2).
-	self assert: '-234.56700' equals:( 234.567 negated printShowingDecimalPlaces: 5).
-	self assert: '23' equals: (23.4567 printShowingDecimalPlaces: 0).
-	self assert: '24' equals: (23.5567 printShowingDecimalPlaces: 0).
-	self assert: '-23' equals: (23.4567 negated printShowingDecimalPlaces: 0).
-	self assert: '-24' equals: (23.5567 negated printShowingDecimalPlaces: 0).
-	self assert: '100000000.0' equals: (100000000 printShowingDecimalPlaces: 1).
-	self assert: '0.98000' equals: (0.98 printShowingDecimalPlaces: 5).
-	self assert: '-0.98' equals: (0.98 negated printShowingDecimalPlaces: 2).
-	self assert: '2.57' equals: (2.567 printShowingDecimalPlaces: 2).
-	self assert: '-2.57' equals: (-2.567 printShowingDecimalPlaces: 2).
-	self assert: '0.00' equals: (0 printShowingDecimalPlaces: 2).
 !
 !
 
 
-testEquality
+testSize
-	self assert: 1 = 1.
+	self assert: #a size equals: 1.
-	self assert: 0 = 0.
+	self assert: #aaaaa size equals: 5
-	self deny: 1 = 0.
-
-	self assert: 1 yourself = 1.
-	self assert: 1 = 1 yourself.
-	self assert: 1 yourself = 1 yourself.
-	
-	self deny: 0 = false.
-	self deny: false = 0.
-	self deny: '' = 0.
-	self deny: 0 = ''
 !
 !
 
 
-testArithmetic
+testAsString
-	
+	self assert: #hello asString equals: 'hello'
-	"We rely on JS here, so we won't test complex behavior, just check if 
-	message sends are corrects"
-
-	self assert: 1.5 + 1 = 2.5.
-	self assert: 2 - 1 = 1.
-	self assert: -2 - 1 = -3.
-	self assert: 12 / 2 = 6.
-	self assert: 3 * 4 = 12.
-
-	"Simple parenthesis and execution order"
-
-	self assert: 1 + 2 * 3 = 9.
-	self assert: 1 + (2 * 3) = 7
 !
 !
 
 
-testRounded
+testAsSymbol
-	
+	self assert: #hello == #hello asSymbol
-	self assert: 3 rounded = 3.
-	self assert: 3.212 rounded = 3.
-	self assert: 3.51 rounded = 4
 !
 !
 
 
-testNegated
+testCopying
-	self assert: 3 negated = -3.
+	self assert: #hello copy == #hello.
-	self assert: -3 negated = 3
+	self assert: #hello deepCopy == #hello
 !
 !
 
 
-testComparison
+testIsSymbolIsString
+	self assert: #hello isSymbol.
+	self deny: 'hello' isSymbol.
+	self deny: #hello isString.
+	self assert: 'hello' isString
+! !
 
 
-	self assert: 3 > 2.
+TestCase subclass: #ObjectTest
-	self assert: 2 < 3.
+	instanceVariableNames: ''
-	
+	category: 'Kernel-Tests'!
-	self deny: 3 < 2.
-	self deny: 2 > 3.
 
 
-	self assert: 3 >= 3.
+!ObjectTest methodsFor: 'tests'!
-	self assert: 3.1 >= 3.
+
-	self assert: 3 <= 3.
+testEquality
-	self assert: 3 <= 3.1
+	| o |
+	o := Object new.
+	self deny: o = Object new.
+	self assert: o = o.
+	self assert: o yourself = o.
+	self assert: o = o yourself
 !
 !
 
 
-testTruncated
+testIdentity
-	
+	| o |
-	self assert: 3 truncated = 3.
+	o := Object new.
-	self assert: 3.212 truncated = 3.
+	self deny: o == Object new.
-	self assert: 3.51 truncated = 3
+	self assert: o == o
 !
 !
 
 
-testCopying
+testHalt
-	self assert: 1 copy == 1.
+	self should: [Object new halt] raise: Error
-	self assert: 1 deepCopy == 1
 !
 !
 
 
-testMinMax
+testBasicAccess
-	
+	| o |
-	self assert: (2 max: 5) equals: 5.
+	o := Object new.
-	self assert: (2 min: 5) equals: 2
+	o basicAt: 'a' put: 1.
+	self assert: (o basicAt: 'a') equals: 1.
+	self assert: (o basicAt: 'b') equals: nil
 !
 !
 
 
-testIdentity
+testNilUndefined
-	self assert: 1 == 1.
+	"nil in Smalltalk is the undefined object in JS"
-	self assert: 0 == 0.
-	self deny: 1 == 0.
 
 
-	self assert: 1 yourself == 1.
+	self assert: nil = undefined
-	self assert: 1 == 1 yourself.
-	self assert: 1 yourself == 1 yourself.
-	
-	self deny: 1 == 2
 !
 !
 
 
-testSqrt
+testidentityHash
+	| o1 o2 |
 	
 	
-	self assert: 4 sqrt = 2.
+	o1 := Object new.
-	self assert: 16 sqrt = 4
+	o2 := Object new.
-!
 
 
-testSquared
+	self assert: o1 identityHash == o1 identityHash.
-	
+	self deny: o1 identityHash == o2 identityHash
-	self assert: 4 squared = 16
 !
 !
 
 
-testTimesRepeat
+testBasicPerform
-	| i |
+	| o |
+	o := Object new.
+	o basicAt: 'func' put: ['hello'].	
+	o basicAt: 'func2' put: [:a | a + 1].
 
 
-	i := 0.
+	self assert: (o basicPerform: 'func')	 equals: 'hello'.
-	0 timesRepeat: [i := i + 1].
+	self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4
-	self assert: i equals: 0.
+!
 
 
-	5 timesRepeat: [i := i + 1].
+testIfNil
-	self assert: i equals: 5
+	self deny: Object new isNil.
+	self deny: (Object new ifNil: [true]) = true.
+	self assert: (Object new ifNotNil: [true]) = true.
+
+	self assert: (Object new ifNil: [false] ifNotNil: [true]) = true.
+	self assert: (Object new ifNotNil: [true] ifNil: [false]) = true
 !
 !
 
 
-testTo
+testInstVars
-	self assert: (1 to: 5) equals: #(1 2 3 4 5)
+	| o |
+	o := ObjectMock new.
+	self assert: (o instVarAt: #foo) equals: nil.
+
+	o instVarAt: #foo put: 1.
+	self assert: (o instVarAt: #foo) equals: 1.
+	self assert: (o instVarAt: 'foo') equals: 1
 !
 !
 
 
-testToBy
+testYourself
-	self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).
+	| o |
+	o := ObjectMock new.
+	self assert: o yourself == o
+!
 
 
-	self should: [1 to: 4 by: 0] raise: Error
+testDNU
+	self should: [Object new foo] raise: MessageNotUnderstood
 ! !
 ! !
 
 
-TestCase subclass: #JSObjectProxyTest
+TestCase subclass: #BlockClosureTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!JSObjectProxyTest methodsFor: 'accessing'!
+!BlockClosureTest methodsFor: 'tests'!
-
-jsObject
-	<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}}>
-! !
 
 
-!JSObjectProxyTest methodsFor: 'tests'!
+testValue
-
+	self assert: ([1+1] value) equals: 2.
-testMethodWithArguments
+	self assert: ([:x | x +1] value: 2) equals: 3.
-	self deny: ('body' asJQuery hasClass: 'amber').
+	self assert: ([:x :y | x*y] value: 2 value: 4) equals: 8. 
 
 
-	'body' asJQuery addClass: 'amber'.
+	"Arguments are optional in Amber. This isn't ANSI compliant."
-	self assert: ('body' asJQuery hasClass: 'amber').
 
 
-	'body' asJQuery removeClass: 'amber'.
+	self assert: ([:a :b :c | 1] value) equals: 1
-	self deny: ('body' asJQuery hasClass: 'amber').
 !
 !
 
 
-testYourself
+testOnDo
-	|body|
+	self assert: ([Error new signal] on: Error do: [:ex | true])
-	body := 'body' asJQuery
+!
-				addClass: 'amber';
-				yourself.
-
-	self assert: (body hasClass: 'amber').
 
 
-	body removeClass: 'amber'.
+testEnsure
-	self deny: (body hasClass: 'amber').
+	self assert: ([Error new] ensure: [true])
 !
 !
 
 
-testPropertyThatReturnsEmptyString
+testNumArgs
-	<document.location.hash = ''>.
+	self assert: [] numArgs equals: 0.
-	self assert: '' equals: document location hash.
+	self assert: [:a :b | ] numArgs equals: 2
+!
 
 
-	document location hash: 'test'.
+testValueWithPossibleArguments
-	self assert: '#test' equals: document location hash.
+	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.
 !
 !
 
 
-testDNU
+testWhileTrue
-	self should: [self jsObject foo] raise: MessageNotUnderstood
+	| 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
 !
 !
 
 
-testMessageSend
+testWhileFalse
+	| i |
+	i := 0.
+	[i > 5] whileFalse: [i := i + 1].
+	self assert: i equals: 6.
 
 
-	self assert: self jsObject a equals: 1.
+	i := 0.
-	self assert: self jsObject b equals: 2.
+	[i := i + 1. i > 5] whileFalse.
-	self assert: (self jsObject c: 3) equals: 3
+	self assert: i equals: 6
 !
 !
 
 
-testPrinting
+testCompiledSource
-	self assert: self jsObject printString = '[object Object]'
+	self assert: ([1+1] compiledSource includesSubString: 'function')
 ! !
 ! !
 
 
 TestCase subclass: #PackageTest
 TestCase subclass: #PackageTest
@@ -485,396 +435,482 @@ testGrulCommitPathJsShouldBeServerGrulJs
 	self assert: 'server/grul/js' equals: grulPackage commitPathJs
 	self assert: 'server/grul/js' equals: grulPackage commitPathJs
 ! !
 ! !
 
 
-TestCase subclass: #BlockClosureTest
+TestCase subclass: #JSObjectProxyTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!BlockClosureTest methodsFor: 'tests'!
+!JSObjectProxyTest methodsFor: 'accessing'!
 
 
-testValue
+jsObject
-	self assert: ([1+1] value) equals: 2.
+	<return jsObject = {a: 1, b: function() {return 2;}, c: function(object) {return object;}}>
-	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."
+!JSObjectProxyTest methodsFor: 'tests'!
 
 
-	self assert: ([:a :b :c | 1] value) equals: 1
+testMethodWithArguments
-!
+	self deny: ('body' asJQuery hasClass: 'amber').
 
 
-testOnDo
+	'body' asJQuery addClass: 'amber'.
-	self assert: ([Error new signal] on: Error do: [:ex | true])
+	self assert: ('body' asJQuery hasClass: 'amber').
-!
 
 
-testEnsure
+	'body' asJQuery removeClass: 'amber'.
-	self assert: ([Error new] ensure: [true])
+	self deny: ('body' asJQuery hasClass: 'amber').
 !
 !
 
 
-testNumArgs
+testYourself
-	self assert: [] numArgs equals: 0.
+	|body|
-	self assert: [:a :b | ] numArgs equals: 2
+	body := 'body' asJQuery
-!
+				addClass: 'amber';
+				yourself.
 
 
-testValueWithPossibleArguments
+	self assert: (body hasClass: 'amber').
-	self assert: ([1] valueWithPossibleArguments: #(3 4)) equals: 1.
+
-	self assert: ([:a | a + 4] valueWithPossibleArguments: #(3 4)) equals: 7.
+	body removeClass: 'amber'.
-	self assert: ([:a :b | a + b] valueWithPossibleArguments: #(3 4 5)) equals: 7.
+	self deny: (body hasClass: 'amber').
 !
 !
 
 
-testWhileTrue
+testPropertyThatReturnsEmptyString
-	| i |
+	<document.location.hash = ''>.
-	i := 0.
+	self assert: '' equals: document location hash.
-	[i < 5] whileTrue: [i := i + 1].
-	self assert: i equals: 5.
 
 
-	i := 0.
+	document location hash: 'test'.
-	[i := i + 1. i < 5] whileTrue.
+	self assert: '#test' equals: document location hash.
-	self assert: i equals: 5
 !
 !
 
 
-testWhileFalse
+testDNU
-	| i |
+	self should: [self jsObject foo] raise: MessageNotUnderstood
-	i := 0.
+!
-	[i > 5] whileFalse: [i := i + 1].
-	self assert: i equals: 6.
 
 
-	i := 0.
+testMessageSend
-	[i := i + 1. i > 5] whileFalse.
+
-	self assert: i equals: 6
+	self assert: self jsObject a equals: 1.
+	self assert: self jsObject b equals: 2.
+	self assert: (self jsObject c: 3) equals: 3
 !
 !
 
 
-testCompiledSource
+testPrinting
-	self assert: ([1+1] compiledSource includesSubString: 'function')
+	self assert: self jsObject printString = '[object Object]'
 ! !
 ! !
 
 
-TestCase subclass: #ObjectTest
+TestCase subclass: #NumberTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!ObjectTest methodsFor: 'tests'!
+!NumberTest methodsFor: 'tests'!
+
+testPrintShowingDecimalPlaces
+	self assert: '23.00' equals: (23 printShowingDecimalPlaces: 2).
+	self assert: '23.57' equals: (23.5698 printShowingDecimalPlaces: 2).
+	self assert: '-234.56700' equals:( 234.567 negated printShowingDecimalPlaces: 5).
+	self assert: '23' equals: (23.4567 printShowingDecimalPlaces: 0).
+	self assert: '24' equals: (23.5567 printShowingDecimalPlaces: 0).
+	self assert: '-23' equals: (23.4567 negated printShowingDecimalPlaces: 0).
+	self assert: '-24' equals: (23.5567 negated printShowingDecimalPlaces: 0).
+	self assert: '100000000.0' equals: (100000000 printShowingDecimalPlaces: 1).
+	self assert: '0.98000' equals: (0.98 printShowingDecimalPlaces: 5).
+	self assert: '-0.98' equals: (0.98 negated printShowingDecimalPlaces: 2).
+	self assert: '2.57' equals: (2.567 printShowingDecimalPlaces: 2).
+	self assert: '-2.57' equals: (-2.567 printShowingDecimalPlaces: 2).
+	self assert: '0.00' equals: (0 printShowingDecimalPlaces: 2).
+!
 
 
 testEquality
 testEquality
-	| o |
+	self assert: 1 = 1.
-	o := Object new.
+	self assert: 0 = 0.
-	self deny: o = Object new.
+	self deny: 1 = 0.
-	self assert: o = o.
+
-	self assert: o yourself = o.
+	self assert: 1 yourself = 1.
-	self assert: o = o yourself
+	self assert: 1 = 1 yourself.
+	self assert: 1 yourself = 1 yourself.
+	
+	self deny: 0 = false.
+	self deny: false = 0.
+	self deny: '' = 0.
+	self deny: 0 = ''
 !
 !
 
 
-testIdentity
+testArithmetic
-	| o |
+	
-	o := Object new.
+	"We rely on JS here, so we won't test complex behavior, just check if 
-	self deny: o == Object new.
+	message sends are corrects"
-	self assert: o == o
+
+	self assert: 1.5 + 1 = 2.5.
+	self assert: 2 - 1 = 1.
+	self assert: -2 - 1 = -3.
+	self assert: 12 / 2 = 6.
+	self assert: 3 * 4 = 12.
+
+	"Simple parenthesis and execution order"
+
+	self assert: 1 + 2 * 3 = 9.
+	self assert: 1 + (2 * 3) = 7
 !
 !
 
 
-testHalt
+testRounded
-	self should: [Object new halt] raise: Error
+	
+	self assert: 3 rounded = 3.
+	self assert: 3.212 rounded = 3.
+	self assert: 3.51 rounded = 4
 !
 !
 
 
-testBasicAccess
+testNegated
-	| o |
+	self assert: 3 negated = -3.
-	o := Object new.
+	self assert: -3 negated = 3
-	o basicAt: 'a' put: 1.
-	self assert: (o basicAt: 'a') equals: 1.
-	self assert: (o basicAt: 'b') equals: nil
 !
 !
 
 
-testNilUndefined
+testComparison
-	"nil in Smalltalk is the undefined object in JS"
 
 
-	self assert: nil = undefined
+	self assert: 3 > 2.
+	self assert: 2 < 3.
+	
+	self deny: 3 < 2.
+	self deny: 2 > 3.
+
+	self assert: 3 >= 3.
+	self assert: 3.1 >= 3.
+	self assert: 3 <= 3.
+	self assert: 3 <= 3.1
 !
 !
 
 
-testidentityHash
+testTruncated
-	| o1 o2 |
 	
 	
-	o1 := Object new.
+	self assert: 3 truncated = 3.
-	o2 := Object new.
+	self assert: 3.212 truncated = 3.
+	self assert: 3.51 truncated = 3
+!
 
 
-	self assert: o1 identityHash == o1 identityHash.
+testCopying
-	self deny: o1 identityHash == o2 identityHash
+	self assert: 1 copy == 1.
+	self assert: 1 deepCopy == 1
 !
 !
 
 
-testBasicPerform
+testMinMax
-	| o |
+	
-	o := Object new.
+	self assert: (2 max: 5) equals: 5.
-	o basicAt: 'func' put: ['hello'].	
+	self assert: (2 min: 5) equals: 2
-	o basicAt: 'func2' put: [:a | a + 1].
+!
 
 
-	self assert: (o basicPerform: 'func')	 equals: 'hello'.
+testIdentity
-	self assert: (o basicPerform: 'func2' withArguments: #(3)) equals: 4
+	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
 !
 !
 
 
-testIfNil
+testSqrt
-	self deny: Object new isNil.
+	
-	self deny: (Object new ifNil: [true]) = true.
+	self assert: 4 sqrt = 2.
-	self assert: (Object new ifNotNil: [true]) = true.
+	self assert: 16 sqrt = 4
+!
 
 
-	self assert: (Object new ifNil: [false] ifNotNil: [true]) = true.
+testSquared
-	self assert: (Object new ifNotNil: [true] ifNil: [false]) = true
+	
+	self assert: 4 squared = 16
 !
 !
 
 
-testInstVars
+testTimesRepeat
-	| o |
+	| i |
-	o := ObjectMock new.
-	self assert: (o instVarAt: #foo) equals: nil.
 
 
-	o instVarAt: #foo put: 1.
+	i := 0.
-	self assert: (o instVarAt: #foo) equals: 1.
+	0 timesRepeat: [i := i + 1].
-	self assert: (o instVarAt: 'foo') equals: 1
+	self assert: i equals: 0.
+
+	5 timesRepeat: [i := i + 1].
+	self assert: i equals: 5
 !
 !
 
 
-testYourself
+testTo
-	| o |
+	self assert: (1 to: 5) equals: #(1 2 3 4 5)
-	o := ObjectMock new.
-	self assert: o yourself == o
 !
 !
 
 
-testDNU
+testToBy
-	self should: [Object new foo] raise: MessageNotUnderstood
+	self assert: (0 to: 6 by: 2) equals: #(0 2 4 6).
+
+	self should: [1 to: 4 by: 0] raise: Error
 ! !
 ! !
 
 
-TestCase subclass: #SymbolTest
+TestCase subclass: #BooleanTest
 	instanceVariableNames: ''
 	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!SymbolTest methodsFor: 'tests'!
+!BooleanTest methodsFor: 'tests'!
+
+testLogic
+ 
+	"Trivial logic table"
+	self assert: (true & true); deny: (true & false); deny: (false & true); deny: (false & false).
+	self assert: (true | true); assert: (true | false); assert: (false | true); deny: (false | false).
+        "Checking that expressions work fine too"
+	self assert: (true & (1 > 0)); deny: ((1 > 0) & false); deny: ((1 > 0) & (1 > 2)).
+        self assert: (false | (1 > 0)); assert: ((1 > 0) | false); assert: ((1 > 0) | (1 > 2))
+!
 
 
 testEquality
 testEquality
-	self assert: #hello = #hello.
+	"We're on top of JS...just be sure to check the basics!!"
-	self deny: #hello = #world.
 
 
-	self assert: #hello  = #hello yourself.
+	self deny: 0 = false. 
-	self assert: #hello yourself = #hello.
+	self deny: false = 0.
+	self deny: '' = false.
+	self deny: false = ''.
 
 
-	self deny: #hello  = 'hello'.
+	self assert: true = true.
-	self deny: 'hello' = #hello.
+	self deny: false = true.
-!
+	self deny: true = false.
+	self assert: false = false.
 
 
-testAt
+	"JS may do some type coercing after sending a message"
-	self assert: (#hello at: 1) = 'h'.
+	self assert: true yourself = true.
-	self assert: (#hello at: 5) = 'o'.
+	self assert: true yourself = true yourself
-	self assert: (#hello at: 6 ifAbsent: [nil]) = nil
 !
 !
 
 
-testAtPut
+testLogicKeywords
-	"Symbol instances are read-only"
+ 
-	self should: ['hello' at: 1 put: 'a'] raise: Error
+	"Trivial logic table"
+	self 
+		assert: (true and: [ true]); 
+		deny: (true and: [ false ]); 
+		deny: (false and: [ true ]); 
+		deny: (false and: [ false ]).
+	self 
+		assert: (true or: [ true ]); 
+		assert: (true or: [ false ]); 
+		assert: (false or: [ true ]); 
+		deny: (false or: [ false ]).
+        
+	"Checking that expressions work fine too"
+	self 
+		assert: (true and: [ 1 > 0 ]); 
+		deny: ((1 > 0) and: [ false ]); 
+		deny: ((1 > 0) and: [ 1 > 2 ]).
+        self 
+		assert: (false or: [ 1 > 0 ]); 
+		assert: ((1 > 0) or: [ false ]); 
+		assert: ((1 > 0) or: [ 1 > 2 ])
 !
 !
 
 
-testIdentity
+testIfTrueIfFalse
-	self assert: #hello == #hello.
+ 
-	self deny: #hello == #world.
+	self assert: (true ifTrue: ['alternative block']) = 'alternative block'.
+	self assert: (true ifFalse: ['alternative block']) = nil.
 
 
-	self assert: #hello  = #hello yourself.
+	self assert: (false ifTrue: ['alternative block']) = nil.
-	self assert: #hello yourself = #hello asString asSymbol
+	self assert: (false ifFalse: ['alternative block']) = 'alternative block'.
+
+	self assert: (false ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block2'.
+	self assert: (false ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block'.
+
+	self assert: (true ifTrue: ['alternative block'] ifFalse: ['alternative block2']) = 'alternative block'.
+	self assert: (true ifFalse: ['alternative block'] ifTrue: ['alternative block2']) = 'alternative block2'.
+! !
+
+TestCase subclass: #DictionaryTest
+	instanceVariableNames: ''
+	category: 'Kernel-Tests'!
+
+!DictionaryTest methodsFor: 'tests'!
+
+testPrintString
+	self
+		assert: 'a Dictionary(''firstname'' -> ''James'' , ''lastname'' -> ''Bond'')' 
+		equals: (Dictionary new 
+                         	at:'firstname' put: 'James';
+                        	at:'lastname' put: 'Bond';
+                        	printString)
 !
 !
 
 
-testComparing
+testEquality
-	self assert: #ab > #aa.
+	| d1 d2 |
-	self deny: #ab > #ba.
-
-	self assert: #ab < #ba.
-	self deny: #bb < #ba.
 
 
-	self assert: #ab >= #aa.
+	self assert: Dictionary new = Dictionary new.
-	self deny: #ab >= #ba.
+		
+	d1 := Dictionary new at: 1 put: 2; yourself.
+	d2 := Dictionary new at: 1 put: 2; yourself.
+	self assert: d1 = d2.
 
 
-	self assert: #ab <= #ba.
+	d2 := Dictionary new at: 1 put: 3; yourself.
-	self deny: #bb <= #ba
+	self deny: d1 = d2.
-!
 
 
-testSize
+	d2 := Dictionary new at: 2 put: 2; yourself.
-	self assert: #a size equals: 1.
+	self deny: d1 = d2.
-	self assert: #aaaaa size equals: 5
-!
 
 
-testAsString
+	d2 := Dictionary new at: 1 put: 2; at: 3 put: 4; yourself.
-	self assert: #hello asString equals: 'hello'
+	self deny: d1 = d2.
 !
 !
 
 
-testAsSymbol
+testDynamicDictionaries
-	self assert: #hello == #hello asSymbol
+	self assert: #{'hello' -> 1} asDictionary = (Dictionary with: 'hello' -> 1)
 !
 !
 
 
-testCopying
+testAccessing
-	self assert: #hello copy == #hello.
+	| d |
-	self assert: #hello deepCopy == #hello
-!
 
 
-testIsSymbolIsString
+	d := Dictionary new.
-	self assert: #hello isSymbol.
-	self deny: 'hello' isSymbol.
-	self deny: #hello isString.
-	self assert: 'hello' isString
-! !
 
 
-Object subclass: #ObjectMock
+	d at: 'hello' put: 'world'.
-	instanceVariableNames: 'foo bar'
+	self assert: (d at: 'hello') = 'world'.
-	category: 'Kernel-Tests'!
+	self assert: (d at: 'hello' ifAbsent: [nil]) = 'world'.
+	self deny: (d at: 'foo' ifAbsent: [nil]) = 'world'.
 
 
-!ObjectMock methodsFor: 'not yet classified'!
+	d at: 1 put: 2.
+	self assert: (d at: 1) = 2.
 
 
-foo
+	d at: 1@3 put: 3.
-	^foo
+	self assert: (d at: 1@3) = 3
 !
 !
 
 
-foo: anObject
+testSize
-	foo := anObject
+	| d |
-! !
 
 
-TestCase subclass: #UndefinedTest
+	d := Dictionary new.
-	instanceVariableNames: ''
+	self assert: d size = 0.
-	category: 'Kernel-Tests'!
 
 
-!UndefinedTest methodsFor: 'tests'!
+	d at: 1 put: 2.
+	self assert: d size = 1.
 
 
-testIsNil
+	d at: 2 put: 3.
-	self assert: nil isNil.
+	self assert: d size = 2.
-	self deny: nil notNil.
 !
 !
 
 
-testIfNil
+testValues
-	self assert: (nil ifNil: [true]) equals: true.
+	| d |
-	self deny: (nil ifNotNil: [true]) = true.
-	self assert: (nil ifNil: [true] ifNotNil: [false]) equals: true.
-	self deny: (nil ifNotNil: [true] ifNil: [false]) = true
-!
 
 
-testCopying
+	d := Dictionary new.
-	self assert: nil copy equals: nil
+	d at: 1 put: 2.
-!
+	d at: 2 put: 3.
+	d at: 3 put: 4.
 
 
-testDeepCopy
+	self assert: d values = #(2 3 4)
-	self assert: nil deepCopy = nil
+!
-! !
 
 
-TestCase subclass: #PointTest
+testKeys
-	instanceVariableNames: ''
+	| d |
-	category: 'Kernel-Tests'!
 
 
-!PointTest methodsFor: 'tests'!
+	d := Dictionary new.
+	d at: 1 put: 2.
+	d at: 2 put: 3.
+	d at: 3 put: 4.
 
 
-testAccessing
+	self assert: d keys = #(1 2 3)
-	self assert: (Point x: 3 y: 4) x equals: 3.
-	self assert: (Point x: 3 y: 4) y equals: 4.
-	self assert: (Point new x: 3) x equals: 3.
-	self assert: (Point new y: 4) y equals: 4
 !
 !
 
 
-testAt
+testRemoveKeyIfAbsent
-	self assert: 3@4 equals: (Point x: 3 y: 4)
+	| d key |
-!
 
 
-testEgality
+	d := Dictionary new.
-	self assert: 3@4 = (3@4).
+	d at: 1 put: 2.
-	self deny: 3@5 = (3@6)
+	d at: 2 put: 3.
-!
+	d at: 3 put: 4.
 
 
-testArithmetic
+	key := 2.
-	self assert: 3@4 * (3@4 ) equals: (Point x: 9 y: 16).
+	self assert: (d removeKey: key) = 3.
-	self assert: 3@4 + (3@4 ) equals: (Point x: 6 y: 8).
+
-	self assert: 3@4 - (3@4 ) equals: (Point x: 0 y: 0).
+	key := 3.
-	self assert: 6@8 / (3@4 ) equals: (Point x: 2 y: 2)
+	self assert: (d removeKey: key ifAbsent: [42]) = 4.
+
+	key := 'why'.
+	self assert: (d removeKey: key ifAbsent: [42] ) = 42.
 !
 !
 
 
-testTranslateBy
+testRemoveKey
-	self assert: 3@4 equals: (3@3 translateBy: 0@1).
+	| d key |
-	self assert: 3@2 equals: (3@3 translateBy: 0@1 negated).
-	self assert: 5@6 equals: (3@3 translateBy: 2@3).
-	self assert: 0@3 equals: (3@3 translateBy: 3 negated @0).
-! !
 
 
-TestCase subclass: #RandomTest
+	d := Dictionary new.
-	instanceVariableNames: ''
+	d at: 1 put: 2.
-	category: 'Kernel-Tests'!
+	d at: 2 put: 3.
+	d at: 3 put: 4.
 
 
-!RandomTest methodsFor: 'tests'!
+	key := 2.
 
 
-textNext
+	self assert: d keys = #(1 2 3).
 
 
-	10000 timesRepeat: [
+	d removeKey: key.
-			| current next | 
+	self assert: d keys = #(1 3).
-			next := Random new next.
+	self assert: d values = #(2 4).
-			self assert: (next >= 0).
+	self deny: (d includesKey: 2)
-			self assert: (next < 1).
-			self deny: current = next.
-			next = current]
 ! !
 ! !
 
 
-TestCase subclass: #ClassBuilderTest
+TestCase subclass: #StringTest
-	instanceVariableNames: 'builder theClass'
+	instanceVariableNames: ''
 	category: 'Kernel-Tests'!
 	category: 'Kernel-Tests'!
 
 
-!ClassBuilderTest methodsFor: 'running'!
+!StringTest methodsFor: 'tests'!
 
 
-setUp
+testJoin
-	builder := ClassBuilder new
+	self assert: 'hello,world' equals: (',' join: #('hello' 'world'))
 !
 !
 
 
-tearDown
+testStreamContents
-	theClass ifNotNil: [Smalltalk current removeClass: theClass. theClass := nil]
+	self 
+		assert: 'hello world' 
+		equals: (String streamContents: [:aStream| aStream 
+                                                 					nextPutAll: 'hello'; space; 
+                                                 					nextPutAll: 'world'])
 !
 !
 
 
-testClassCopy
+testIncludesSubString
-	theClass := builder copyClass: ObjectMock named: 'ObjectMock2'.
+	self assert: ('amber' includesSubString: 'ber').
-	self assert: theClass superclass == ObjectMock superclass.
+	self deny: ('amber' includesSubString: 'zork').
-	self assert: theClass instanceVariableNames == ObjectMock instanceVariableNames.
-	self assert: theClass name equals: 'ObjectMock2'.
-	self assert: theClass package == ObjectMock package.
-	self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys
 !
 !
 
 
-testInstanceVariableNames
+testEquality
-	self assert: (builder instanceVariableNamesFor: '  hello   world   ') equals: #('hello' 'world')
+	self assert: 'hello' = 'hello'.
-! !
+	self deny: 'hello' = 'world'.
 
 
-TestCase subclass: #SetTest
+	self assert: 'hello'  = 'hello' yourself.
-	instanceVariableNames: ''
+	self assert: 'hello' yourself = 'hello'.
-	category: 'Kernel-Tests'!
 
 
-!SetTest methodsFor: 'tests'!
+	"test JS falsy value"
+	self deny: '' = 0
+!
 
 
-testUnicity
+testCopyWithoutAll
-	| set |
+	self 
-	set := Set new.
+		assert: 'hello world' 
-	set add: 21.
+		equals: ('*hello* *world*' copyWithoutAll: '*')
-	set add: 'hello'.
+!
 
 
-	set add: 21.
+testAt
-	self assert: set size = 2.
+	self assert: ('hello' at: 1) = 'h'.
-	
+	self assert: ('hello' at: 5) = 'o'.
-	set add: 'hello'.
+	self assert: ('hello' at: 6 ifAbsent: [nil]) = nil
-	self assert: set size = 2.
+!
 
 
-	self assert: set asArray equals: #(21 'hello')
+testAtPut
+	"String instances are read-only"
+	self should: ['hello' at: 1 put: 'a'] raise: Error
 !
 !
 
 
-testAt
+testSize
-	self should: [Set new at: 1 put: 2] raise: Error
+	self assert: 'smalltalk' size equals: 9.
+	self assert: '' size equals: 0
 !
 !
 
 
 testAddRemove
 testAddRemove
-	| set |
+	self should: ['hello' add: 'a'] raise: Error.
-	set := Set new.
+	self should: ['hello' remove: 'h'] raise: Error
-	
+!
-	self assert: set isEmpty.
 
 
-	set add: 3.
+testAsArray
-	self assert: (set includes: 3).
+	self assert: 'hello' asArray = #('h' 'e' 'l' 'l' 'o').
+! !
 
 
-	set add: 5.
+TestCase subclass: #ArrayTest
-	self assert: (set includes: 5).
+	instanceVariableNames: ''
+	category: 'Kernel-Tests'!
 
 
-	set remove: 3.
+!ArrayTest methodsFor: 'testing'!
-	self deny: (set includes: 3)
+
+testFirstN
+	self assert: {1. 2. 3} equals: ({1. 2. 3. 4. 5} first: 3).
 !
 !
 
 
-testSize
+testIfEmpty
-	self assert: Set new size equals: 0.
+	self assert: 'zork' equals: ( '' ifEmpty: ['zork'] )
-	self assert: (Set withAll: #(1 2 3 4)) size equals: 4.
-	self assert: (Set withAll: #(1 1 1 1)) size equals: 1
 ! !
 ! !
 
 
 PackageTest subclass: #PackageWithDefaultCommitPathChangedTest
 PackageTest subclass: #PackageWithDefaultCommitPathChangedTest

Some files were not shown because too many files changed in this diff