/
parrotlib.t
120 lines (89 loc) · 2.64 KB
/
parrotlib.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!perl
# Copyright (C) 2001-2005, Parrot Foundation.
# $Id$
use strict;
use warnings;
use lib qw( t . lib ../lib ../../lib );
use Test::More;
use Parrot::Test tests => 6;
use Parrot::Config;
=head1 NAME
t/library/parrotlib.t - testing library/parrotlib.pir
=head1 SYNOPSIS
% prove t/library/parrotlib.t
=head1 DESCRIPTION
This test program test whether the library 'parrotlib.pir' returns the
expected absolute filenames.
=cut
# Common code in the test files
my $template_top = << 'END_CODE';
.sub _main
load_bytecode 'runtime/parrot/include/parrotlib.pbc'
.local pmc location_sub
.local string location
END_CODE
my $template_bottom = << 'END_CODE';
print location
print "\n"
end
.end
END_CODE
# Testing include_file_location
pir_output_is( << "END_CODE", << 'END_OUT', 'include_file_location' );
$template_top
location_sub = get_global ["_parrotlib"], "include_file_location"
location = location_sub( 'datatypes.pasm' )
$template_bottom
END_CODE
runtime/parrot/include/datatypes.pasm
END_OUT
pir_output_is( << "END_CODE", << 'END_OUT', 'include_file_location, non-existent' );
$template_top
location_sub = get_global ['_parrotlib'], "include_file_location"
location = location_sub( 'nonexistent.pasm' )
$template_bottom
END_CODE
END_OUT
# Testing imcc_compile_file_location
pir_output_is( << "END_CODE", << 'END_OUT', 'imcc_compile_file_location' );
$template_top
location_sub = get_global ['_parrotlib'], "imcc_compile_file_location"
location = location_sub( 'parrotlib.pbc' )
$template_bottom
END_CODE
runtime/parrot/include/parrotlib.pbc
END_OUT
pir_output_is( << "END_CODE", << 'END_OUT', 'imcc_compile_file_location, non-existent' );
$template_top
location_sub = get_global ['_parrotlib'], "imcc_compile_file_location"
location = location_sub( 'nonexistent.pbc' )
$template_bottom
END_CODE
END_OUT
# Testing dynext_location
pir_output_is( << "END_CODE", << "END_OUT", 'dynext_location' );
$template_top
location_sub = get_global ['_parrotlib'], "dynext_location"
location = location_sub( 'libnci_test', '$PConfig{load_ext}' )
$template_bottom
END_CODE
runtime/parrot/dynext/libnci_test$PConfig{load_ext}
END_OUT
pir_output_is( << "END_CODE", << 'END_OUT', 'dynext_location, non-existent' );
$template_top
location_sub = get_global ['_parrotlib'], "imcc_compile_file_location"
location = location_sub( 'nonexistent' )
$template_bottom
END_CODE
END_OUT
=head1 AUTHOR
Bernhard Schmalhofer <Bernhard.Schmalhofer@gmx.de>
=head1 SEE ALSO
F<runtime/parrot/library/parrotlib.pir>
=cut
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
# fill-column: 100
# End:
# vim: expandtab shiftwidth=4: