[svn:parrot] r42676 - trunk/t/library

mikehh at svn.parrot.org mikehh at svn.parrot.org
Sat Nov 21 08:46:24 UTC 2009


Author: mikehh
Date: Sat Nov 21 08:46:22 2009
New Revision: 42676
URL: https://trac.parrot.org/parrot/changeset/42676

Log:
[PATCH] convert t/library/parrotlib.t to PIR from bubaflub++ (TT #1313)

Modified:
   trunk/t/library/parrotlib.t

Modified: trunk/t/library/parrotlib.t
==============================================================================
--- trunk/t/library/parrotlib.t	Sat Nov 21 07:03:29 2009	(r42675)
+++ trunk/t/library/parrotlib.t	Sat Nov 21 08:46:22 2009	(r42676)
@@ -1,14 +1,7 @@
-#!perl
-# Copyright (C) 2001-2005, Parrot Foundation.
+#!parrot
+# Copyright (C) 2001-2009, 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
@@ -26,81 +19,82 @@
 
 # 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
+.sub main :main
+    load_bytecode 'runtime/parrot/include/parrotlib.pbc'
 
-my $template_bottom = << 'END_CODE';
-  print location
-  print "\n"
+    .include 'test_more.pir'
+    plan(6)
 
-  end
+    test_include_file_location()
+    test_include_file_location_non_existent()
+    test_imcc_compile_file_location()
+    test_imcc_compile_file_location_non_existent()
+    test_dynext_location()
+    test_dynext_location_non_existent()
 .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
+.sub test_include_file_location
+    .local pmc    location_sub
+    .local string location
+    location_sub = get_global ["_parrotlib"], "include_file_location"
+    location     = location_sub( 'datatypes.pasm' )
+    is(location,'runtime/parrot/include/datatypes.pasm', 'include file location' )
+.end
 
-END_OUT
+.sub test_include_file_location_non_existent
+    .local pmc    location_sub
+    .local string location
+    location_sub = get_global ['_parrotlib'], "include_file_location"
+    location     = location_sub( 'nonexistent.pasm' )
+    is(location, '', 'include file location non-existent')
+.end
 
 # 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
+.sub test_imcc_compile_file_location
+    .local pmc    location_sub
+    .local string location
+    location_sub = get_global ['_parrotlib'], "imcc_compile_file_location"
+    location     = location_sub( 'parrotlib.pbc' )
+    is(location, 'runtime/parrot/include/parrotlib.pbc','imcc compile file location')
+.end
 
-END_OUT
+.sub test_imcc_compile_file_location_non_existent
+    .local pmc    location_sub
+    .local string location
+    location_sub = get_global ['_parrotlib'], "imcc_compile_file_location"
+    location     = location_sub( 'nonexistent.pbc' )
+    is(location, '', 'imcc compile file location, non-existent')
+.end
 
 # 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
+.sub test_dynext_location
+    .include 'iglobals.pasm'
+    .local pmc config_hash, interp
+    .local pmc    location_sub
+    .local string location
+
+    interp = getinterp
+    config_hash = interp[.IGLOBALS_CONFIG_HASH]
+    $S0 = config_hash['load_ext']
+    location_sub = get_global ['_parrotlib'], "dynext_location"
+    location     = location_sub( 'libnci_test', $S0 )
+    $S1 = 'runtime/parrot/dynext/libnci_test'
+    $S1 .= $S0
+    is(location, $S1, 'dynext_location')
+.end
 
-END_OUT
+.sub test_dynext_location_non_existent
+    .local pmc    location_sub
+    .local string location
+    location_sub = get_global ['_parrotlib'], "imcc_compile_file_location"
+    location     = location_sub( 'nonexistent' )
+    is(location, '', 'dynext location non-existent')
+.end
 
 =head1 AUTHOR
 
@@ -117,4 +111,4 @@
 #   cperl-indent-level: 4
 #   fill-column: 100
 # End:
-# vim: expandtab shiftwidth=4:
+# vim: expandtab shiftwidth=4 filetype=pir:


More information about the parrot-commits mailing list