/
config.t
75 lines (63 loc) · 1.37 KB
/
config.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
#! perl
# Copyright (C) 2005-2007, Parrot Foundation.
# $Id$
use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 3;
use Parrot::Config;
use Cwd qw(cwd);
=head1 NAME
t/pmc/config.t - Builtin Config
=head1 SYNOPSIS
% prove t/pmc/config.t
=head1 DESCRIPTION
Tests the parrot config interface.
=cut
pir_output_is( <<'CODE', <<'OUT', "get config hash" );
.sub main :main
.include "iglobals.pasm"
.local pmc config_hash, interp
interp = getinterp
config_hash = interp[.IGLOBALS_CONFIG_HASH]
typeof $S0, config_hash
print $S0
print "\n"
.end
CODE
Hash
OUT
pir_output_is( <<'CODE', ($^O eq 'MSWin32' ? lc(cwd) : cwd), "prefix" );
.sub main :main
load_bytecode "config.pbc"
.include "iglobals.pasm"
.local pmc config_hash, interp, cfg
interp = getinterp
config_hash = interp[.IGLOBALS_CONFIG_HASH]
$S0 = config_hash["prefix"]
cfg = _config()
$S1 = cfg['osname']
if $S1 != 'MSWin32' goto sayit
downcase $S0
sayit:
print $S0
.end
CODE
pir_output_is( <<'CODE', <<'OUT', "load src/pbc from library path" );
.sub main :main
load_bytecode "config.pir"
print "ok 1\n"
load_bytecode "config.pbc"
print "ok 2\n"
.end
CODE
ok 1
ok 2
OUT
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: