253 " |
254 " |
254 self retSelf |
255 self retSelf |
255 1000000 timesRepeat:[self retSelf] |
256 1000000 timesRepeat:[self retSelf] |
256 Time millisecondsToRun:[ 1000000 timesRepeat:[self retSelf] ] |
257 Time millisecondsToRun:[ 1000000 timesRepeat:[self retSelf] ] |
257 " |
258 " |
258 ! ! |
|
259 |
|
260 !CompilerTest methodsFor:'cleanup'! |
|
261 |
|
262 tearDown |
|
263 self class removeSelector:#foo:. |
|
264 |
|
265 "Created: / 05-07-2011 / 18:20:08 / cg" |
|
266 ! ! |
259 ! ! |
267 |
260 |
268 !CompilerTest methodsFor:'helpers'! |
261 !CompilerTest methodsFor:'helpers'! |
269 |
262 |
270 callEnsureWith2Returns |
263 callEnsureWith2Returns |
1928 ! ! |
1917 ! ! |
1929 |
1918 |
1930 !CompilerTest methodsFor:'tests - parsing'! |
1919 !CompilerTest methodsFor:'tests - parsing'! |
1931 |
1920 |
1932 testParseBadLiteral |
1921 testParseBadLiteral |
1933 self assert:( (self class compile:'foo ^ #( a b ( c d (' ) == #Error ) . |
1922 self should:[self class compile:'foo ^ #( a b ( c d (' ] raise:Parser parseErrorSignal. |
1934 self assert:( (self class compile:'foo ^ #( a b ( c d ()' ) == #Error ). |
1923 self should:[self class compile:'foo ^ #( a b ( c d ()'] raise:Parser parseErrorSignal. |
1935 self assert:( (self class compile:'foo ^ #( a b ( c d ())' ) == #Error ). |
1924 self should:[self class compile:'foo ^ #( a b ( c d ())'] raise:Parser parseErrorSignal. |
1936 self assert:( (self class compile:'foo ^ #( a b ( c d ()))' ) ~~ #Error ). |
1925 self assert:((self class compile:'foo ^ #( a b ( c d ()))') ~~ #Error). |
1937 self class removeSelector:#foo. |
|
1938 |
1926 |
1939 " |
1927 " |
1940 self new testParseBadLiteral |
1928 self new testParseBadLiteral |
1941 " |
1929 " |
1942 ! |
1930 ! |
1972 |
1960 |
1973 [ |
1961 [ |
1974 ParserFlags warnPlausibilityChecks:true. |
1962 ParserFlags warnPlausibilityChecks:true. |
1975 ParserFlags warnAboutPossibleSTCCompilationProblems:true. |
1963 ParserFlags warnAboutPossibleSTCCompilationProblems:true. |
1976 ParserFlags allowPossibleSTCCompilationProblems:false. |
1964 ParserFlags allowPossibleSTCCompilationProblems:false. |
1977 |
|
1978 self should:[ |
1965 self should:[ |
1979 Compiler |
1966 self |
1980 compile:' |
1967 compile:' |
1981 foo:arg |
1968 foo:arg |
1982 ^ arg |
1969 ^ arg |
1983 ifTrue:[^ 1] |
1970 ifTrue:[^ 1] |
1984 ifFalse:[2] |
1971 ifFalse:[2] |
1985 ' |
1972 ' |
1986 forClass:self class. |
|
1987 ] |
1973 ] |
1988 raise:Parser parseErrorSignal |
1974 raise:Parser parseErrorSignal |
1989 ] ensure:[ |
1975 ] ensure:[ |
1990 ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
1976 ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
1991 ParserFlags allowPossibleSTCCompilationProblems:a. |
1977 ParserFlags allowPossibleSTCCompilationProblems:a. |
2000 |
1986 |
2001 w := ParserFlags warnAboutPossibleSTCCompilationProblems. |
1987 w := ParserFlags warnAboutPossibleSTCCompilationProblems. |
2002 a := ParserFlags allowPossibleSTCCompilationProblems. |
1988 a := ParserFlags allowPossibleSTCCompilationProblems. |
2003 |
1989 |
2004 [ |
1990 [ |
2005 ParserFlags warnAboutPossibleSTCCompilationProblems:false. |
1991 ParserFlags warnAboutPossibleSTCCompilationProblems:false. |
2006 ParserFlags allowPossibleSTCCompilationProblems:true. |
1992 ParserFlags allowPossibleSTCCompilationProblems:true. |
2007 |
1993 |
2008 setOfSignals := SignalSet with:(Parser parseErrorSignal) with:(Parser parseWarningSignal). |
1994 setOfSignals := SignalSet with:(Parser parseErrorSignal) with:(Parser parseWarningSignal). |
2009 self |
1995 self |
2010 shouldnt: |
1996 shouldnt: |
2011 [ |
1997 [ |
2012 Compiler |
1998 self |
2013 compile:' |
1999 compile:' |
2014 foo:arg |
2000 foo:arg |
2015 ^ arg |
2001 ^ arg |
2016 ifTrue:[^ 1] |
2002 ifTrue:[^ 1] |
2017 ifFalse:[2] |
2003 ifFalse:[2] |
2018 ' |
2004 ' |
2019 forClass:self class. |
2005 ] |
2020 ] |
2006 raise:setOfSignals. |
2021 raise:setOfSignals. |
|
2022 ] ensure:[ |
2007 ] ensure:[ |
2023 ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
2008 ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
2024 ParserFlags allowPossibleSTCCompilationProblems:a. |
2009 ParserFlags allowPossibleSTCCompilationProblems:a. |
2025 ] |
2010 ] |
2026 |
2011 |
2027 "Created: / 16-11-2006 / 14:33:29 / cg" |
2012 "Created: / 16-11-2006 / 14:33:29 / cg" |
2028 ! |
2013 ! |
2029 |
2014 |
2030 test_good_return1 |
2015 test_good_return1 |
2031 |setOfPossibleExceptions| |
2016 |setOfPossibleExceptions| |
2032 |
2017 |
2033 setOfPossibleExceptions := SignalSet with:(Parser::ParseWarning) with:(Parser::ParseError). |
2018 setOfPossibleExceptions := SignalSet with:(Parser::ParseWarning) with:(Parser::ParseError). |
2034 self |
2019 self |
2035 shouldnt: |
2020 shouldnt: |
2036 [ |
2021 [ |
2037 Compiler |
2022 self |
2038 compile:' |
2023 compile:' |
2039 foo:arg |
2024 foo:arg |
2040 arg |
2025 arg |
2041 ifTrue:[^ 1] |
2026 ifTrue:[^ 1] |
2042 ifFalse:[^ 2] |
2027 ifFalse:[^ 2] |
2043 ' |
2028 ' |
2044 forClass:self class. |
2029 ] |
2045 ] |
2030 raise:setOfPossibleExceptions. |
2046 raise:setOfPossibleExceptions. |
|
2047 |
2031 |
2048 "Created: / 16-11-2006 / 14:16:53 / cg" |
2032 "Created: / 16-11-2006 / 14:16:53 / cg" |
2049 ! |
2033 ! |
2050 |
2034 |
2051 test_good_return2 |
2035 test_good_return2 |
2052 |setOfPossibleExceptions| |
2036 |setOfPossibleExceptions| |
2053 |
2037 |
2054 setOfPossibleExceptions := SignalSet with:(Parser parseWarningSignal) with:(Parser parseErrorSignal). |
2038 setOfPossibleExceptions := SignalSet with:(Parser parseWarningSignal) with:(Parser parseErrorSignal). |
2055 self |
2039 self |
2056 shouldnt: |
2040 shouldnt: |
2057 [ |
2041 [ |
2058 Compiler |
2042 self |
2059 compile:' |
2043 compile:' |
2060 foo:arg |
2044 foo:arg |
2061 ^ arg |
2045 ^ arg |
2062 ifTrue:[1] |
2046 ifTrue:[1] |
2063 ifFalse:[2] |
2047 ifFalse:[2] |
2064 ' |
2048 ' |
2065 forClass:self class. |
2049 ] |
2066 ] |
2050 raise:setOfPossibleExceptions. |
2067 raise:setOfPossibleExceptions. |
|
2068 |
2051 |
2069 "Created: / 16-11-2006 / 14:41:45 / cg" |
2052 "Created: / 16-11-2006 / 14:41:45 / cg" |
2070 ! ! |
2053 ! ! |
2071 |
2054 |
2072 !CompilerTest methodsFor:'tests - sends'! |
2055 !CompilerTest methodsFor:'tests - sends'! |