|
@@ -2407,6 +2407,45 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.IndexableCollectionTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAtIfAbsentPut",
|
|
|
+protocol: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+var newCollection;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $1;
|
|
|
+newCollection=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=1;
|
|
|
+self._samplesDo_((function(index,value){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+$1=_st(newCollection)._at_ifAbsentPut_(index,(function(){
|
|
|
+return smalltalk.withContext(function($ctx3) {
|
|
|
+return self._sampleNewValue();
|
|
|
+$ctx3.sendIdx["sampleNewValue"]=1;
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
|
|
|
+$ctx2.sendIdx["at:ifAbsentPut:"]=1;
|
|
|
+return self._assert_equals_($1,value);
|
|
|
+$ctx2.sendIdx["assert:equals:"]=1;
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)})}));
|
|
|
+self._assert_equals_(newCollection,self._collection());
|
|
|
+$ctx1.sendIdx["assert:equals:"]=2;
|
|
|
+self._assert_equals_(_st(newCollection)._at_ifAbsentPut_(self._sampleNewIndex(),(function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+return self._sampleNewValue();
|
|
|
+$ctx2.sendIdx["sampleNewValue"]=2;
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})})),self._sampleNewValue());
|
|
|
+$ctx1.sendIdx["assert:equals:"]=3;
|
|
|
+self._assert_equals_(newCollection,self._collectionWithNewValue());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},smalltalk.IndexableCollectionTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAtIfAbsentPut\x0a\x09| newCollection |\x0a\x09newCollection := self collection.\x0a\x09self samplesDo: [ :index :value |\x0a\x09\x09self assert: (newCollection at: index ifAbsentPut: [ self sampleNewValue ]) equals: value ].\x0a\x09self assert: newCollection equals: self collection.\x0a\x09self assert: (newCollection at: self sampleNewIndex ifAbsentPut: [ self sampleNewValue ]) equals: self sampleNewValue.\x0a\x09self assert: newCollection equals: self collectionWithNewValue",
|
|
|
+messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.IndexableCollectionTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAtIfPresent",
|
|
@@ -4627,6 +4666,29 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.StringTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAtIfAbsentPut",
|
|
|
+protocol: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+self._should_raise_((function(){
|
|
|
+return smalltalk.withContext(function($ctx2) {
|
|
|
+return "hello"._at_ifAbsentPut_((6),(function(){
|
|
|
+return smalltalk.withContext(function($ctx3) {
|
|
|
+return "a";
|
|
|
+}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
|
|
|
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}),$Error());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},smalltalk.StringTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
|
|
|
+messageSends: ["should:raise:", "at:ifAbsentPut:"],
|
|
|
+referencedClasses: ["Error"]
|
|
|
+}),
|
|
|
+smalltalk.StringTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAtPut",
|
|
@@ -5143,6 +5205,57 @@ referencedClasses: ["Set"]
|
|
|
}),
|
|
|
smalltalk.SetTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testAddAll",
|
|
|
+protocol: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $2,$3,$4,$5,$1,$6,$8,$9,$10,$11,$7,$12,$14,$15,$13;
|
|
|
+smalltalk.SetTest.superclass.fn.prototype._testAddAll.apply(_st(self), []);
|
|
|
+$2=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=1;
|
|
|
+$3=$2;
|
|
|
+$4=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=2;
|
|
|
+_st($3)._addAll_($4);
|
|
|
+$ctx1.sendIdx["addAll:"]=1;
|
|
|
+$5=_st($2)._yourself();
|
|
|
+$ctx1.sendIdx["yourself"]=1;
|
|
|
+$1=$5;
|
|
|
+$6=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=3;
|
|
|
+self._assert_equals_($1,$6);
|
|
|
+$ctx1.sendIdx["assert:equals:"]=1;
|
|
|
+$8=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=4;
|
|
|
+$9=$8;
|
|
|
+$10=self._collectionWithNewValue();
|
|
|
+$ctx1.sendIdx["collectionWithNewValue"]=1;
|
|
|
+_st($9)._addAll_($10);
|
|
|
+$ctx1.sendIdx["addAll:"]=2;
|
|
|
+$11=_st($8)._yourself();
|
|
|
+$ctx1.sendIdx["yourself"]=2;
|
|
|
+$7=$11;
|
|
|
+$12=self._collectionWithNewValue();
|
|
|
+$ctx1.sendIdx["collectionWithNewValue"]=2;
|
|
|
+self._assert_equals_($7,$12);
|
|
|
+$ctx1.sendIdx["assert:equals:"]=2;
|
|
|
+$14=self._collectionWithNewValue();
|
|
|
+$ctx1.sendIdx["collectionWithNewValue"]=3;
|
|
|
+_st($14)._addAll_(self._collection());
|
|
|
+$15=_st($14)._yourself();
|
|
|
+$13=$15;
|
|
|
+self._assert_equals_($13,self._collectionWithNewValue());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testAddAll",{},smalltalk.SetTest)})},
|
|
|
+args: [],
|
|
|
+source: "testAddAll\x0a\x09super testAddAll.\x0a\x09self assert: (self collection addAll: self collection; yourself) equals: self collection.\x0a\x09self assert: (self collection addAll: self collectionWithNewValue; yourself) equals: self collectionWithNewValue.\x0a\x09self assert: (self collectionWithNewValue addAll: self collection; yourself) equals: self collectionWithNewValue",
|
|
|
+messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.SetTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testAddRemove",
|
|
@@ -5221,6 +5334,47 @@ referencedClasses: []
|
|
|
}),
|
|
|
smalltalk.SetTest);
|
|
|
|
|
|
+smalltalk.addMethod(
|
|
|
+smalltalk.method({
|
|
|
+selector: "testComma",
|
|
|
+protocol: 'tests',
|
|
|
+fn: function (){
|
|
|
+var self=this;
|
|
|
+return smalltalk.withContext(function($ctx1) {
|
|
|
+var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
|
|
|
+smalltalk.SetTest.superclass.fn.prototype._testComma.apply(_st(self), []);
|
|
|
+$2=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=1;
|
|
|
+$3=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=2;
|
|
|
+$1=_st($2).__comma($3);
|
|
|
+$ctx1.sendIdx[","]=1;
|
|
|
+$4=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=3;
|
|
|
+self._assert_equals_($1,$4);
|
|
|
+$ctx1.sendIdx["assert:equals:"]=1;
|
|
|
+$6=self._collection();
|
|
|
+$ctx1.sendIdx["collection"]=4;
|
|
|
+$7=self._collectionWithNewValue();
|
|
|
+$ctx1.sendIdx["collectionWithNewValue"]=1;
|
|
|
+$5=_st($6).__comma($7);
|
|
|
+$ctx1.sendIdx[","]=2;
|
|
|
+$8=self._collectionWithNewValue();
|
|
|
+$ctx1.sendIdx["collectionWithNewValue"]=2;
|
|
|
+self._assert_equals_($5,$8);
|
|
|
+$ctx1.sendIdx["assert:equals:"]=2;
|
|
|
+$10=self._collectionWithNewValue();
|
|
|
+$ctx1.sendIdx["collectionWithNewValue"]=3;
|
|
|
+$9=_st($10).__comma(self._collection());
|
|
|
+self._assert_equals_($9,self._collectionWithNewValue());
|
|
|
+return self}, function($ctx1) {$ctx1.fill(self,"testComma",{},smalltalk.SetTest)})},
|
|
|
+args: [],
|
|
|
+source: "testComma\x0a\x09super testComma.\x0a\x09self assert: self collection, self collection equals: self collection.\x0a\x09self assert: self collection, self collectionWithNewValue equals: self collectionWithNewValue.\x0a\x09self assert: self collectionWithNewValue, self collection equals: self collectionWithNewValue",
|
|
|
+messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"],
|
|
|
+referencedClasses: []
|
|
|
+}),
|
|
|
+smalltalk.SetTest);
|
|
|
+
|
|
|
smalltalk.addMethod(
|
|
|
smalltalk.method({
|
|
|
selector: "testComparing",
|