Browse Source

Merge branch 'master' into impCodeGenerator

Nicolas Petton 12 năm trước cách đây
mục cha
commit
04ae316d5a
12 tập tin đã thay đổi với 865 bổ sung411 xóa
  1. 112 112
      js/IDE.deploy.js
  2. 112 112
      js/IDE.js
  3. 11 0
      js/Kernel-Collections.deploy.js
  4. 16 0
      js/Kernel-Collections.js
  5. 228 96
      js/Kernel-Tests.deploy.js
  6. 277 90
      js/Kernel-Tests.js
  7. 11 0
      js/SUnit.deploy.js
  8. 16 0
      js/SUnit.js
  9. 1 1
      st/IDE.st
  10. 6 0
      st/Kernel-Collections.st
  11. 71 0
      st/Kernel-Tests.st
  12. 4 0
      st/SUnit.st

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 112 - 112
js/IDE.deploy.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 112 - 112
js/IDE.js


+ 11 - 0
js/Kernel-Collections.deploy.js

@@ -1962,6 +1962,17 @@ return self;}
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+"_do_",
+smalltalk.method({
+selector: "do:",
+fn: function (aBlock) {
+var self=this;
+for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
+return self;}
+}),
+smalltalk.String);
+
 smalltalk.addMethod(
 "_escaped",
 smalltalk.method({

+ 16 - 0
js/Kernel-Collections.js

@@ -2773,6 +2773,22 @@ referencedClasses: []
 }),
 smalltalk.String);
 
+smalltalk.addMethod(
+"_do_",
+smalltalk.method({
+selector: "do:",
+category: 'enumerating',
+fn: function (aBlock) {
+var self=this;
+for(var i=0;i<self.length;i++){aBlock(self.charAt(i));};
+return self;},
+args: ["aBlock"],
+source: "do: aBlock\x0a\x09<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>",
+messageSends: [],
+referencedClasses: []
+}),
+smalltalk.String);
+
 smalltalk.addMethod(
 "_escaped",
 smalltalk.method({

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 228 - 96
js/Kernel-Tests.deploy.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 277 - 90
js/Kernel-Tests.js


+ 11 - 0
js/SUnit.deploy.js

@@ -183,6 +183,17 @@ return self;}
 }),
 smalltalk.TestCase.klass);
 
+smalltalk.addMethod(
+"_isAbstract",
+smalltalk.method({
+selector: "isAbstract",
+fn: function () {
+var self=this;
+return smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
+return self;}
+}),
+smalltalk.TestCase.klass);
+
 smalltalk.addMethod(
 "_lookupHierarchyRoot",
 smalltalk.method({

+ 16 - 0
js/SUnit.js

@@ -263,6 +263,22 @@ referencedClasses: []
 }),
 smalltalk.TestCase.klass);
 
+smalltalk.addMethod(
+"_isAbstract",
+smalltalk.method({
+selector: "isAbstract",
+category: 'testing',
+fn: function () {
+var self=this;
+return smalltalk.send(smalltalk.send(self, "_name", []), "__eq", ["TestCase"]);
+return self;},
+args: [],
+source: "isAbstract\x0a\x09^ self name = 'TestCase'",
+messageSends: ["=", "name"],
+referencedClasses: []
+}),
+smalltalk.TestCase.klass);
+
 smalltalk.addMethod(
 "_lookupHierarchyRoot",
 smalltalk.method({

+ 1 - 1
st/IDE.st

@@ -1985,7 +1985,7 @@ TabWidget subclass: #TestRunner
 !TestRunner methodsFor: 'accessing'!
 
 allClasses
-	^TestCase allSubclasses
+	^TestCase allSubclasses select: [ :each | each isAbstract not ]
 !
 
 classes

+ 6 - 0
st/Kernel-Collections.st

@@ -1063,6 +1063,12 @@ shallowCopy
 	^self class fromString: self
 ! !
 
+!String methodsFor: 'enumerating'!
+
+do: aBlock
+	<for(var i=0;i<self.length;i++){aBlock(self.charAt(i));}>
+! !
+
 !String methodsFor: 'printing'!
 
 printNl

+ 71 - 0
st/Kernel-Tests.st

@@ -220,6 +220,77 @@ testInstanceVariableNames
 	self assert: (builder instanceVariableNamesFor: '  hello   world   ') equals: #('hello' 'world')
 ! !
 
+TestCase subclass: #CollectionTest
+	instanceVariableNames: ''
+	package: 'Kernel-Tests'!
+
+!CollectionTest methodsFor: 'accessing'!
+
+collection
+	^ self collectionClass withAll: self defaultValues
+!
+
+collectionClass
+	^ self class collectionClass
+!
+
+defaultValues
+	^ #('a' 1 2 #e)
+! !
+
+!CollectionTest methodsFor: 'convenience'!
+
+assertSameContents: aCollection 	as: anotherCollection
+	self assert: aCollection size = anotherCollection size.
+	aCollection do: [ :each |
+		self assert: (aCollection at: each) = (anotherCollection at: each) ]
+! !
+
+!CollectionTest methodsFor: 'testing'!
+
+testAsArray
+	self 
+		assertSameContents: self collection 
+		as: self collection asArray
+!
+
+testAsOrderedCollection
+	self 
+		assertSameContents: self collection 
+		as: self collection asOrderedCollection
+!
+
+testAsSet
+	| c set |
+	c := self collectionClass withAll: #('a' 'b' 'c' 1 2 1 'a').
+	set := c asSet.
+	self assert: set size = 5.
+	c do: [ :each |
+		self assert: (set includes: each) ]
+!
+
+testIsEmpty
+	self assert: self collectionClass new isEmpty.
+	self deny: self collection isEmpty
+!
+
+testSize
+	self assert: self collectionClass new size = 0.
+	self assert: self collection size = 4
+! !
+
+!CollectionTest class methodsFor: 'accessing'!
+
+collectionClass
+	^ nil
+! !
+
+!CollectionTest class methodsFor: 'testing'!
+
+isAbstract
+	^ self collectionClass notNil
+! !
+
 TestCase subclass: #DictionaryTest
 	instanceVariableNames: ''
 	package: 'Kernel-Tests'!

+ 4 - 0
st/SUnit.st

@@ -106,6 +106,10 @@ testSelectors
 
 !TestCase class methodsFor: 'testing'!
 
+isAbstract
+	^ self name = 'TestCase'
+!
+
 shouldInheritSelectors
 	^self ~= self lookupHierarchyRoot
 ! !

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác