Explorar o código

Move methods isTestXXX to SUnit package

Ryan Simmons %!s(int64=10) %!d(string=hai) anos
pai
achega
9e4223b73b
Modificáronse 6 ficheiros con 57 adicións e 53 borrados
  1. 0 22
      src/Kernel-Classes.js
  2. 0 5
      src/Kernel-Classes.st
  3. 0 21
      src/Kernel-Infrastructure.js
  4. 0 4
      src/Kernel-Infrastructure.st
  5. 44 1
      src/SUnit.js
  6. 13 0
      src/SUnit.st

+ 0 - 22
src/Kernel-Classes.js

@@ -529,28 +529,6 @@ referencedClasses: []
 }),
 globals.Behavior);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "isTestClass",
-protocol: 'testing',
-fn: function (){
-var self=this;
-function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st(self._includesBehavior_($TestCase()))._and_((function(){
-return smalltalk.withContext(function($ctx2) {
-return _st(self._isAbstract())._not();
-}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"isTestClass",{},globals.Behavior)})},
-args: [],
-source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
-messageSends: ["and:", "includesBehavior:", "not", "isAbstract"],
-referencedClasses: ["TestCase"]
-}),
-globals.Behavior);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "javascriptConstructor",

+ 0 - 5
src/Kernel-Classes.st

@@ -348,11 +348,6 @@ inheritsFrom: aClass
 
 isBehavior
 	^ true
-!
-
-isTestClass
-	^(self includesBehavior: TestCase) and: [ 
-			self isAbstract not ]
 ! !
 
 Behavior subclass: #Class

+ 0 - 21
src/Kernel-Infrastructure.js

@@ -1669,27 +1669,6 @@ referencedClasses: []
 }),
 globals.Package);
 
-smalltalk.addMethod(
-smalltalk.method({
-selector: "isTestPackage",
-protocol: 'testing',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-$1=_st(self._classes())._anySatisfy_((function(each){
-return smalltalk.withContext(function($ctx2) {
-return _st(each)._isTestClass();
-}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
-return $1;
-}, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},globals.Package)})},
-args: [],
-source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
-messageSends: ["anySatisfy:", "classes", "isTestClass"],
-referencedClasses: []
-}),
-globals.Package);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "loadDependencies",

+ 0 - 4
src/Kernel-Infrastructure.st

@@ -689,10 +689,6 @@ isDirty
 
 isPackage
 	^ true
-!
-
-isTestPackage
-	^ self classes anySatisfy: [ :each | each isTestClass ]
 ! !
 
 Package class instanceVariableNames: 'defaultCommitPathJs defaultCommitPathSt'!

+ 44 - 1
src/SUnit.js

@@ -1,4 +1,4 @@
-define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions"], function($boot){
+define("amber_core/SUnit", ["amber/boot", "amber_core/Kernel-Objects", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Classes", "amber_core/Kernel-Infrastructure"], function($boot){
 var smalltalk=$boot.vm,nil=$boot.nil,_st=$boot.asReceiver,globals=$boot.globals;
 smalltalk.addPackage('SUnit');
 smalltalk.packages["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
@@ -1232,4 +1232,47 @@ referencedClasses: []
 }),
 globals.TestSuiteRunner.klass);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTestClass",
+protocol: '*SUnit',
+fn: function (){
+var self=this;
+function $TestCase(){return globals.TestCase||(typeof TestCase=="undefined"?nil:TestCase)}
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._includesBehavior_($TestCase()))._and_((function(){
+return smalltalk.withContext(function($ctx2) {
+return _st(self._isAbstract())._not();
+}, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isTestClass",{},globals.Behavior)})},
+args: [],
+source: "isTestClass\x0a\x09^(self includesBehavior: TestCase) and: [ \x0a\x09\x09\x09self isAbstract not ]",
+messageSends: ["and:", "includesBehavior:", "not", "isAbstract"],
+referencedClasses: ["TestCase"]
+}),
+globals.Behavior);
+
+smalltalk.addMethod(
+smalltalk.method({
+selector: "isTestPackage",
+protocol: '*SUnit',
+fn: function (){
+var self=this;
+return smalltalk.withContext(function($ctx1) { 
+var $1;
+$1=_st(self._classes())._anySatisfy_((function(each){
+return smalltalk.withContext(function($ctx2) {
+return _st(each)._isTestClass();
+}, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
+return $1;
+}, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},globals.Package)})},
+args: [],
+source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
+messageSends: ["anySatisfy:", "classes", "isTestClass"],
+referencedClasses: []
+}),
+globals.Package);
+
 });

+ 13 - 0
src/SUnit.st

@@ -443,3 +443,16 @@ on: aCollection
 	^ super new suite: aCollection
 ! !
 
+!Behavior methodsFor: '*SUnit'!
+
+isTestClass
+	^(self includesBehavior: TestCase) and: [ 
+			self isAbstract not ]
+! !
+
+!Package methodsFor: '*SUnit'!
+
+isTestPackage
+	^ self classes anySatisfy: [ :each | each isTestClass ]
+! !
+