2 # Copyright (C) 2001-2008, The Perl Foundation.
7 use lib qw( . lib ../lib ../../lib );
12 use Parrot::Test tests => 34;
14 pir_output_is( <<'CODE', <<'OUT', "globalconst 1" );
17 .globalconst int N = 5
33 pir_output_is( <<'CODE', <<'OUT', "globalconst 2" );
35 .globalconst int N = 5
53 pir_output_is( <<'CODE', <<'OUT', "globalconst 3" );
60 .globalconst int N = 5
73 pir_output_is( <<'CODE', <<'OUT', "array/hash consts" );
78 .const string key2 = "key2"
102 pir_output_is( <<'CODE', <<'OUT', "escaped" );
114 # fix editor highlighting "
116 pir_output_is( <<'CODE', <<'OUT', "PMC const 1 - Sub" );
118 .const .Sub $P0 = "foo"
132 pir_output_is( <<'CODE', <<'OUT', "PMC const 2 - Sub ident" );
134 .const .Sub func = "foo"
148 pasm_output_is( <<'CODE', <<'OUT', "const I/N mismatch" );
162 pir_output_is( <<'CODE', <<'OUT', "const I/N mismatch 2" );
170 .const string s = ascii:"ok 2\n"
180 pir_output_is( <<'CODE', <<'OUT', 'PIR heredocs: accepts double quoted terminator' );
184 Oh, I want an elephat!
185 Oh, woo, elephants, yeah :-O
192 Oh, I want an elephat!
193 Oh, woo, elephants, yeah :-O
196 pir_output_is( <<'CODE', <<'OUT', 'PIR heredocs: accepts inline with concat' );
216 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: accepts terminator with any word chars" );
218 $S0 = <<"AnY_w0Rd_ch4rS"
248 pir_output_is( <<'CODE', <<'OUT', 'PIR heredoc: single quoted terminator' );
250 $S0 = <<'Jabberwocky'
251 `Twas brillig, and the slithy toves
252 Did gyre and gimble in the wabe;
253 All mimsy were the borogoves,
254 And the mome raths outgrabe.
259 `Twas brillig, and the slithy toves
260 Did gyre and gimble in the wabe;
261 All mimsy were the borogoves,
262 And the mome raths outgrabe.
265 pir_output_is( <<'CODE', <<'OUT', 'PIR heredoc: single quoted - backslash' );
276 pir_error_output_like( <<'CODE', <<'OUT', 'PIR heredoc: rejects unquoted terminator' );
279 "Beware the Jabberwock, my son!
280 The jaws that bite, the claws that catch!
281 Beware the Jubjub bird, and shun
282 The frumious Bandersnatch!"
287 /^error:imcc:syntax error, unexpected SHIFT_LEFT.*/
290 pir_error_output_like( <<'CODE', <<'OUT', "PIR heredoc: rejects inline heredoc" );
293 He took his vorpal sword in hand:
294 Long time the manxome foe he sought --
295 So rested he by the Tumtum tree,
296 And stood awhile in thought.
302 /^error:imcc:syntax error, unexpected SHIFT_LEFT.*/
305 pir_error_output_like( <<'CODE', <<'OUT', "PIR heredoc: rejects null terminator" );
308 And, as in uffish thought he stood,
309 The Jabberwock, with eyes of flame,
310 Came whiffling through the tulgey wood,
311 And burbled as it came!
316 /^error:imcc:syntax error, unexpected SHIFT_LEFT.*/
319 pir_error_output_like( <<'CODE', <<'OUT', "PIR heredoc: rejects terminator with spaces" );
321 $S0 = << "terminator with spaces"
322 One, two! One, two! And through and through
323 The vorpal blade went snicker-snack!
324 He left it dead, and with its head
325 He went galumphing back.
326 terminator with spaces
331 /^error:imcc:syntax error, unexpected SHIFT_LEFT.*/
334 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: accepts terminator with non-word chars" );
336 $S0 = <<"#non$word-chars."
337 'And, has thou slain the Jabberwock?
338 Come to my arms, my beamish boy!
339 O frabjous day! Callooh! Callay!'
340 He chortled in his joy.
346 'And, has thou slain the Jabberwock?
347 Come to my arms, my beamish boy!
348 O frabjous day! Callooh! Callay!'
349 He chortled in his joy.
352 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: accepts terminator with unprintable chars" );
355 `Twas brillig, and the slithy toves
356 Did gyre and gimble in the wabe;
357 All mimsy were the borogoves,
358 And the mome raths outgrabe.
363 `Twas brillig, and the slithy toves
364 Did gyre and gimble in the wabe;
365 All mimsy were the borogoves,
366 And the mome raths outgrabe.
369 pir_error_output_like( <<'CODE', <<'OUT', "PIR heredoc: rejects interpolated terminator" );
389 /^error:imcc:syntax error, unexpected SHIFT_LEFT.*/
392 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: rejects variable interpolation" );
396 Happy Birthday to you,
397 Happy Birthday to you.
398 Happy Birthday dear $S0,
399 Happy Birthday to you!
403 Happy Birthday to you,
404 Happy Birthday to you.
405 Happy Birthday dear $S0,
406 Happy Birthday to you!
409 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: allow empty lines" );
414 The line above is empty.
419 The line above is empty.
422 pir_error_output_like( <<'CODE', <<'OUT', "PIR heredoc: line numbers" );
426 bounds 1 # force line nums
433 print nil # force err
439 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: double quoted strings" );
451 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: double quotes - two in a row" );
461 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: double quotes - with anything between" );
472 <<'CODE', <<'OUT', "PIR heredoc: double quotes - two in a row prefaced by anything" );
482 pir_output_is( <<'CODE', <<'OUT', "PIR heredoc: double quotes - escaped with anything between" );
493 <<'CODE', <<'OUT', "PIR heredoc: escaped characters, escaped quotes, starting quotes" );
520 pir_output_is( <<'CODE', <<'OUT', "heredoc not eol 1" );
524 emit(code, <<"HERE", 10)
533 .param pmc args :slurpy
534 $S0 = sprintf more, args
544 pir_error_output_like( <<'CODE', <<'OUT', "heredoc not eol 2 - nested" );
561 /nested heredoc not supported/
564 pir_output_is( <<'CODE', <<'OUT', ".const in mixed opcodes" );
577 pir_output_is( <<'CODE', <<'OUT', "RT # 34991" );
582 # Uncomment this line, and the c symbol is 'forgotten'
597 # cperl-indent-level: 4
600 # vim: expandtab shiftwidth=4: