1292 ! ! |
1292 ! ! |
1293 |
1293 |
1294 !CompilerTest methodsFor:'tests - return'! |
1294 !CompilerTest methodsFor:'tests - return'! |
1295 |
1295 |
1296 test_bad_return2 |
1296 test_bad_return2 |
1297 ParserFlags warnAboutPossibleSTCCompilationProblems:true. |
1297 |w a| |
1298 ParserFlags allowPossibleSTCCompilationProblems:false. |
1298 |
1299 |
1299 w := ParserFlags warnAboutPossibleSTCCompilationProblems. |
1300 self |
1300 a := ParserFlags allowPossibleSTCCompilationProblems. |
1301 should: |
1301 |
1302 [ |
1302 [ |
1303 Compiler |
1303 ParserFlags warnAboutPossibleSTCCompilationProblems:true. |
1304 compile:' |
1304 ParserFlags allowPossibleSTCCompilationProblems:false. |
|
1305 |
|
1306 self |
|
1307 should: |
|
1308 [ |
|
1309 Compiler |
|
1310 compile:' |
1305 foo:arg |
1311 foo:arg |
1306 ^ arg |
1312 ^ arg |
1307 ifTrue:[^ 1] |
1313 ifTrue:[^ 1] |
1308 ifFalse:[2] |
1314 ifFalse:[2] |
1309 ' |
1315 ' |
1310 forClass:self class. |
1316 forClass:self class. |
1311 ] |
1317 ] |
1312 raise:Parser::ParseError. |
1318 raise:Parser::ParseError. |
|
1319 ] ensure:[ |
|
1320 ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
|
1321 ParserFlags allowPossibleSTCCompilationProblems:a. |
|
1322 ]. |
1313 |
1323 |
1314 "Created: / 16-11-2006 / 14:08:48 / cg" |
1324 "Created: / 16-11-2006 / 14:08:48 / cg" |
1315 ! |
1325 ! |
1316 |
1326 |
1317 test_bad_return3 |
1327 test_bad_return3 |
1318 |setOfSignals| |
1328 |w a setOfSignals| |
1319 |
1329 |
1320 ParserFlags warnAboutPossibleSTCCompilationProblems:false. |
1330 w := ParserFlags warnAboutPossibleSTCCompilationProblems. |
1321 ParserFlags allowPossibleSTCCompilationProblems:true. |
1331 a := ParserFlags allowPossibleSTCCompilationProblems. |
1322 |
1332 |
1323 setOfSignals := SignalSet with:(Parser::ParseError) with:(Parser::ParseWarning). |
1333 [ |
1324 self |
1334 ParserFlags warnAboutPossibleSTCCompilationProblems:false. |
1325 shouldnt: |
1335 ParserFlags allowPossibleSTCCompilationProblems:true. |
1326 [ |
1336 |
1327 Compiler |
1337 setOfSignals := SignalSet with:(Parser::ParseError) with:(Parser::ParseWarning). |
1328 compile:' |
1338 self |
|
1339 shouldnt: |
|
1340 [ |
|
1341 Compiler |
|
1342 compile:' |
1329 foo:arg |
1343 foo:arg |
1330 ^ arg |
1344 ^ arg |
1331 ifTrue:[^ 1] |
1345 ifTrue:[^ 1] |
1332 ifFalse:[2] |
1346 ifFalse:[2] |
1333 ' |
1347 ' |
1334 forClass:self class. |
1348 forClass:self class. |
1335 ] |
1349 ] |
1336 raise:setOfSignals. |
1350 raise:setOfSignals. |
|
1351 ] ensure:[ |
|
1352 ParserFlags warnAboutPossibleSTCCompilationProblems:w. |
|
1353 ParserFlags allowPossibleSTCCompilationProblems:a. |
|
1354 ] |
1337 |
1355 |
1338 "Created: / 16-11-2006 / 14:33:29 / cg" |
1356 "Created: / 16-11-2006 / 14:33:29 / cg" |
1339 ! |
1357 ! |
1340 |
1358 |
1341 test_good_return1 |
1359 test_good_return1 |