Browse Source

tests use some falsy element, fixed storage of booleans

Herbert Vojčík 11 years ago
parent
commit
68ced3cb27
4 changed files with 15 additions and 15 deletions
  1. 2 2
      js/Kernel-Collections.js
  2. 8 8
      js/Kernel-Tests.js
  3. 1 1
      st/Kernel-Collections.st
  4. 4 4
      st/Kernel-Tests.st

+ 2 - 2
js/Kernel-Collections.js

@@ -5665,7 +5665,7 @@ return smalltalk.withContext(function($ctx1) {
 
 		self['@slowBuckets'] = Object.create(null);
 		self['@fastBuckets'] = {
-			'boolean': { store: Object.create(null), fn: Boolean },
+			'boolean': { store: Object.create(null), fn: function (x) { return x === 'true'; } },
 			'number': { store: Object.create(null), fn: Number },
 			'string': { store: Object.create(null) }
 		};
@@ -5673,7 +5673,7 @@ return smalltalk.withContext(function($ctx1) {
 	;
 return self}, function($ctx1) {$ctx1.fill(self,"removeAll",{},smalltalk.Set)})},
 args: [],
-source: "removeAll\x0a\x09<\x0a\x09\x09self['@slowBuckets'] = Object.create(null);\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: Boolean },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
+source: "removeAll\x0a\x09<\x0a\x09\x09self['@slowBuckets'] = Object.create(null);\x0a\x09\x09self['@fastBuckets'] = {\x0a\x09\x09\x09'boolean': { store: Object.create(null), fn: function (x) { return x === 'true'; } },\x0a\x09\x09\x09'number': { store: Object.create(null), fn: Number },\x0a\x09\x09\x09'string': { store: Object.create(null) }\x0a\x09\x09};\x0a\x09\x09self['@size'] = 0;\x0a\x09>",
 messageSends: [],
 referencedClasses: []
 }),

+ 8 - 8
js/Kernel-Tests.js

@@ -5345,13 +5345,13 @@ _st($2)._add_(nil);
 $ctx1.sendIdx["add:"]=2;
 _st($2)._add_((3).__at((3)));
 $ctx1.sendIdx["add:"]=3;
-_st($2)._add_((-4));
+_st($2)._add_(false);
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collection",{},smalltalk.SetTest)})},
 args: [],
-source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
+source: "collection\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: false;\x0a\x09\x09yourself",
 messageSends: ["add:", "new", "current", "@", "yourself"],
 referencedClasses: ["Set", "Smalltalk"]
 }),
@@ -5373,13 +5373,13 @@ _st($2)._add_("nil");
 $ctx1.sendIdx["add:"]=2;
 _st($2)._add_("3@3");
 $ctx1.sendIdx["add:"]=3;
-_st($2)._add_("-4");
+_st($2)._add_("false");
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},smalltalk.SetTest)})},
 args: [],
-source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a Smalltalk';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: '-4';\x0a\x09\x09yourself",
+source: "collectionOfPrintStrings\x0a\x09^ Set new\x0a\x09\x09add: 'a Smalltalk';\x0a\x09\x09add: 'nil';\x0a\x09\x09add: '3@3';\x0a\x09\x09add: 'false';\x0a\x09\x09yourself",
 messageSends: ["add:", "new", "yourself"],
 referencedClasses: ["Set"]
 }),
@@ -5410,13 +5410,13 @@ var self=this;
 return smalltalk.withContext(function($ctx1) { 
 var $2,$3,$1;
 $2=self._collection();
-_st($2)._add_("yet another");
+_st($2)._add_((0));
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},smalltalk.SetTest)})},
 args: [],
-source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 'yet another'; yourself",
+source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
 messageSends: ["add:", "collection", "yourself"],
 referencedClasses: []
 }),
@@ -5441,13 +5441,13 @@ _st($2)._add_((3).__at((3)));
 $ctx1.sendIdx["add:"]=3;
 _st($2)._add_("N");
 $ctx1.sendIdx["add:"]=4;
-_st($2)._add_((-4));
+_st($2)._add_(false);
 $3=_st($2)._yourself();
 $1=$3;
 return $1;
 }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},smalltalk.SetTest)})},
 args: [],
-source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: -4;\x0a\x09\x09yourself",
+source: "collectionWithNewValue\x0a\x09^ Set new\x0a\x09\x09add: Smalltalk current;\x0a\x09\x09add: nil;\x0a\x09\x09add: 3@3;\x0a\x09\x09add: 'N';\x0a\x09\x09add: false;\x0a\x09\x09yourself",
 messageSends: ["add:", "new", "current", "@", "yourself"],
 referencedClasses: ["Set", "Smalltalk"]
 }),

+ 1 - 1
st/Kernel-Collections.st

@@ -1770,7 +1770,7 @@ removeAll
 	<
 		self['@slowBuckets'] = Object.create(null);
 		self['@fastBuckets'] = {
-			'boolean': { store: Object.create(null), fn: Boolean },
+			'boolean': { store: Object.create(null), fn: function (x) { return x === 'true'; } },
 			'number': { store: Object.create(null), fn: Number },
 			'string': { store: Object.create(null) }
 		};

+ 4 - 4
st/Kernel-Tests.st

@@ -1499,7 +1499,7 @@ collection
 		add: Smalltalk current;
 		add: nil;
 		add: 3@3;
-		add: -4;
+		add: false;
 		yourself
 !
 
@@ -1508,7 +1508,7 @@ collectionOfPrintStrings
 		add: 'a Smalltalk';
 		add: 'nil';
 		add: '3@3';
-		add: '-4';
+		add: 'false';
 		yourself
 !
 
@@ -1518,7 +1518,7 @@ collectionSize
 
 collectionWithDuplicates
 	"Set has no duplicates"
-	^ self collection add: 'yet another'; yourself
+	^ self collection add: 0; yourself
 !
 
 collectionWithNewValue
@@ -1527,7 +1527,7 @@ collectionWithNewValue
 		add: nil;
 		add: 3@3;
 		add: 'N';
-		add: -4;
+		add: false;
 		yourself
 ! !