RegressionTests__CompilerTest.st
changeset 668 9481f512e9b8
parent 660 ef75857fce73
child 686 3ef16d51a594
--- a/RegressionTests__CompilerTest.st	Mon May 07 12:28:33 2012 +0200
+++ b/RegressionTests__CompilerTest.st	Mon May 07 14:01:27 2012 +0200
@@ -34,11 +34,12 @@
 !CompilerTest class methodsFor:'helpers'!
 
 compile:code
-    Error handle:[:ex |
-	^  #Error
-    ] do:[
-	^ super compile:code
-    ]
+    Class withoutUpdatingChangesDo:[
+        ^ Compiler
+            compile:code
+            forClass:self
+            install:false.
+    ].
 ! !
 
 !CompilerTest class methodsFor:'tests - constants'!
@@ -257,14 +258,6 @@
     "
 ! !
 
-!CompilerTest methodsFor:'cleanup'!
-
-tearDown
-    self class removeSelector:#foo:.
-
-    "Created: / 05-07-2011 / 18:20:08 / cg"
-! !
-
 !CompilerTest methodsFor:'helpers'!
 
 callEnsureWith2Returns
@@ -289,6 +282,14 @@
     "Created: / 24-08-2010 / 12:54:07 / cg"
 !
 
+compile:someCode
+    |m|
+
+    m := self class compile:someCode.
+    self assert:(m notNil and:[m ~~ #Error]).
+    ^ m
+!
+
 size
     ^ 1
 !
@@ -1595,18 +1596,6 @@
 
 !CompilerTest methodsFor:'tests - literals'!
 
-compile:someCode
-    |m|
-
-    m := Compiler
-	    compile:someCode
-	    forClass:nil
-	    install:false.
-
-    self assert:(m notNil and:[m ~~ #Error]).
-    ^ m
-!
-
 testLiterals
     "
      self new testLiterals
@@ -1930,11 +1919,10 @@
 !CompilerTest methodsFor:'tests - parsing'!
 
 testParseBadLiteral
-    self assert:( (self class compile:'foo ^ #( a b ( c d (' ) == #Error ) .
-    self assert:( (self class compile:'foo ^ #( a b ( c d ()' ) == #Error ).
-    self assert:( (self class compile:'foo ^ #( a b ( c d ())' ) == #Error ).
-    self assert:( (self class compile:'foo ^ #( a b ( c d ()))' ) ~~ #Error ).
-    self class removeSelector:#foo.
+    self should:[self class compile:'foo ^ #( a b ( c d (' ] raise:Parser parseErrorSignal.
+    self should:[self class compile:'foo ^ #( a b ( c d ()'] raise:Parser parseErrorSignal.
+    self should:[self class compile:'foo ^ #( a b ( c d ())'] raise:Parser parseErrorSignal.
+    self assert:((self class compile:'foo ^ #( a b ( c d ()))') ~~ #Error).
 
     "
      self new testParseBadLiteral
@@ -1974,16 +1962,14 @@
         ParserFlags warnPlausibilityChecks:true.
         ParserFlags warnAboutPossibleSTCCompilationProblems:true.
         ParserFlags allowPossibleSTCCompilationProblems:false.
-
         self should:[
-            Compiler
+            self
                 compile:'
 foo:arg
-    ^ arg
-        ifTrue:[^ 1]
-        ifFalse:[2]
+^ arg
+    ifTrue:[^ 1]
+    ifFalse:[2]
 '
-                forClass:self class.
             ]
             raise:Parser parseErrorSignal
     ] ensure:[
@@ -2002,26 +1988,25 @@
     a := ParserFlags allowPossibleSTCCompilationProblems.
 
     [
-	ParserFlags warnAboutPossibleSTCCompilationProblems:false.
-	ParserFlags allowPossibleSTCCompilationProblems:true.
-
-	setOfSignals := SignalSet with:(Parser parseErrorSignal) with:(Parser parseWarningSignal).
-	self
-	    shouldnt:
-		[
-		    Compiler
-			compile:'
+        ParserFlags warnAboutPossibleSTCCompilationProblems:false.
+        ParserFlags allowPossibleSTCCompilationProblems:true.
+
+        setOfSignals := SignalSet with:(Parser parseErrorSignal) with:(Parser parseWarningSignal).
+        self
+            shouldnt:
+                [
+                    self
+                        compile:'
 foo:arg
     ^ arg
-	ifTrue:[^ 1]
-	ifFalse:[2]
+        ifTrue:[^ 1]
+        ifFalse:[2]
 '
-			forClass:self class.
-		]
-	    raise:setOfSignals.
+                ]
+            raise:setOfSignals.
     ] ensure:[
-	ParserFlags warnAboutPossibleSTCCompilationProblems:w.
-	ParserFlags allowPossibleSTCCompilationProblems:a.
+        ParserFlags warnAboutPossibleSTCCompilationProblems:w.
+        ParserFlags allowPossibleSTCCompilationProblems:a.
     ]
 
     "Created: / 16-11-2006 / 14:33:29 / cg"
@@ -2032,18 +2017,17 @@
 
     setOfPossibleExceptions := SignalSet with:(Parser::ParseWarning) with:(Parser::ParseError).
     self
-	shouldnt:
-	    [
-		Compiler
-		    compile:'
+        shouldnt:
+            [
+                self
+                    compile:'
 foo:arg
     arg
-	ifTrue:[^ 1]
-	ifFalse:[^ 2]
+        ifTrue:[^ 1]
+        ifFalse:[^ 2]
 '
-		    forClass:self class.
-	    ]
-	raise:setOfPossibleExceptions.
+            ]
+        raise:setOfPossibleExceptions.
 
     "Created: / 16-11-2006 / 14:16:53 / cg"
 !
@@ -2053,18 +2037,17 @@
 
     setOfPossibleExceptions := SignalSet with:(Parser parseWarningSignal) with:(Parser parseErrorSignal).
     self
-	shouldnt:
-	    [
-		Compiler
-		    compile:'
+        shouldnt:
+            [
+                self
+                    compile:'
 foo:arg
     ^ arg
-	ifTrue:[1]
-	ifFalse:[2]
+        ifTrue:[1]
+        ifFalse:[2]
 '
-		    forClass:self class.
-	    ]
-	raise:setOfPossibleExceptions.
+            ]
+        raise:setOfPossibleExceptions.
 
     "Created: / 16-11-2006 / 14:41:45 / cg"
 ! !