diff -r 9a7fa841f12e -r a6d8b93441b0 compiler/PPCASTUtilitiesTests.st --- a/compiler/PPCASTUtilitiesTests.st Mon Aug 17 13:39:38 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -"{ Package: 'stx:goodies/petitparser/compiler' }" - -"{ NameSpace: Smalltalk }" - -TestCase subclass:#PPCASTUtilitiesTests - instanceVariableNames:'' - classVariableNames:'SomeClassVariable' - poolDictionaries:'' - category:'PetitCompiler-Tests-Support' -! - -!PPCASTUtilitiesTests methodsFor:'methods under test'! - -methodSimple1 - ^ 1 - - "Created: / 27-07-2015 / 13:27:44 / Jan Vrany " -! - -methodWithArguments: arg1 - (arg1 + 4) yourself isOdd ifTrue:[ - ^ true - ]. - ^ false not. - - "Created: / 27-07-2015 / 13:35:40 / Jan Vrany " -! - -methodWithClassReference - ^ PPCASTUtilities new - - "Created: / 27-07-2015 / 13:28:53 / Jan Vrany " -! - -methodWithClassVariableReference - ^ SomeClassVariable - - "Created: / 27-07-2015 / 14:02:23 / Jan Vrany " -! - -methodWithInstanceVariableReference - ^ testSelector - - "Created: / 27-07-2015 / 13:29:32 / Jan Vrany " -! - -methodWithSelfSend1 - ^ self methodSimple1 - - "Created: / 27-07-2015 / 13:28:08 / Jan Vrany " -! - -methodWithSelfSend2 - ^ self methodWithSelfSend1 - - "Created: / 27-07-2015 / 13:34:20 / Jan Vrany " -! - -methodWithSelfSend3 - ^ self methodWithInstanceVariableReference - - "Created: / 27-07-2015 / 14:01:26 / Jan Vrany " -! - -methodWithSuperSend - ^ super yourself - - "Created: / 27-07-2015 / 14:02:45 / Jan Vrany " -! - -methodWithTemporaries - | tmp1 | - - tmp1 := 3. - (tmp1 + 4) yourself isOdd ifTrue:[ - | tmp2 | - - tmp2 := tmp1 + 1. - ^ tmp1 + tmp2. - ]. - ^ tmp1 - - "Created: / 27-07-2015 / 13:33:57 / Jan Vrany " -! ! - -!PPCASTUtilitiesTests methodsFor:'tests'! - -test_checkNodeIsFunctional_1 - self shouldnt: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodSimple1) parseTree inClass: self class ] - raise: PPCCompilationError. - self shouldnt: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithSelfSend1) parseTree inClass: self class ] - raise: PPCCompilationError. - self shouldnt: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithSelfSend2) parseTree inClass: self class ] - raise: PPCCompilationError. - self shouldnt: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithClassReference) parseTree inClass: self class ] - raise: PPCCompilationError. - self shouldnt: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithTemporaries) parseTree inClass: self class ] - raise: PPCCompilationError. - self shouldnt: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithArguments:) parseTree inClass: self class ] - raise: PPCCompilationError. - - "Created: / 27-07-2015 / 14:00:10 / Jan Vrany " -! - -test_checkNodeIsFunctional_2 - self should: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithInstanceVariableReference) parseTree inClass: self class ] - raise: PPCCompilationError. - self should: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithClassVariableReference) parseTree inClass: self class ] - raise: PPCCompilationError. - self should: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithSelfSend3) parseTree inClass: self class ] - raise: PPCCompilationError. - self should: [ PPCASTUtilities new checkNodeIsFunctional: (self class >> #methodWithSuperSend) parseTree inClass: self class ] - raise: PPCCompilationError. - - "Created: / 27-07-2015 / 14:00:56 / Jan Vrany " -! ! -