-
Notifications
You must be signed in to change notification settings - Fork 138
/
sys.t
83 lines (66 loc) · 1.44 KB
/
sys.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#! perl
# Copyright (C) 2001-2008, Parrot Foundation.
use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test::Util 'create_tempfile';
use Parrot::Test tests => 2;
=head1 NAME
t/pmc/sys.t - System Tests
=head1 SYNOPSIS
% prove t/pmc/sys.t
=head1 DESCRIPTION
Tests system dependent stuff
=cut
my (undef, $temp_pir) = create_tempfile( SUFFIX => '.pir', UNLINK => 1 );
pir_output_is( <<"CODE", <<OUT, "spawnw, _config" );
.sub _test :main
.local pmc O
O = new ['FileHandle']
O.'open'("$temp_pir", 'w')
print O, ".sub _main :main\\n"
print O, "\tsay \\"Hello, World!\\"\\n"
print O, ".end\\n"
O.'close'()
load_bytecode 'config.pbc'
.local pmc conf_hash
conf_hash = _config()
.local string slash
slash = conf_hash["slash"]
.local string parrot
parrot = conf_hash["test_prog"]
.local string cmd
cmd = '.'
cmd .= slash
cmd .= parrot
cmd .= " $temp_pir"
spawnw \$I0, cmd
say \$I0
.end
CODE
Hello, World!
0
OUT
pir_output_is( <<'CODE', <<'OUT', "conf_hash is read-only")
.sub _test :main
load_bytecode 'config.pbc'
.local pmc conf_hash
conf_hash = _config()
push_eh is_ro
conf_hash['foo'] = 'bar'
pop_eh
goto end
is_ro:
say 'hash is read-only'
end:
.end
CODE
hash is read-only
OUT
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: