On Saturday 07 October 2006 08:20, Leopold Toetsch wrote: > Am Samstag, 7. Oktober 2006 17:00 schrieb Bob Rogers: > > ## WTF??? > > .sub main :main > > load_bytecode "Data/Dumper" > > .end > > There's a test missing, if the file is a diretory obviously.
Something like this? -- c MANIFEST | 1 + compilers/imcc/parser_util.c | 8 ++++++++ t/op/load_bytecode.t | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+)
=== MANIFEST ================================================================== --- MANIFEST (revision 22948) +++ MANIFEST (local) @@ -2590,6 +2590,7 @@ t/op/jitn.t [] t/op/lexicals.t [] t/op/literal.t [] +t/op/load_bytecode.t [] t/op/number.t [] t/op/random.t [] t/op/spawnw.t [] === compilers/imcc/parser_util.c ================================================================== --- compilers/imcc/parser_util.c (revision 22948) +++ compilers/imcc/parser_util.c (local) @@ -776,6 +776,14 @@ IMCC_INFO(interp) = imc_info; } + STRING *fs; + fs = string_make(interp, fullname, strlen(fullname), NULL, 0); + if (Parrot_stat_info_intval(interp, fs, STAT_ISDIR)) { + IMCC_fatal(interp, E_IOError, + "imcc_compile_file: '%s' is a directory\n", fullname); + return NULL; + } + if (!(fp = fopen(fullname, "r"))) { IMCC_fatal(interp, E_IOError, "imcc_compile_file: couldn't open '%s'\n", fullname); === t/op/load_bytecode.t ================================================================== --- t/op/load_bytecode.t (revision 22948) +++ t/op/load_bytecode.t (local) @@ -0,0 +1,39 @@ +#!perl +# Copyright (C) 2006, The Perl Foundation. +# $Id$ + +use strict; +use warnings; +use lib qw( . lib ../lib ../../lib ); +use Test::More; +use Parrot::Test tests => 2; + +=head1 NAME + +t/op/load_bytecode.t - loading bytecode tests + +=head1 SYNOPSIS + + % prove t/op/load_bytecode.t + +=head1 DESCRIPTION + +Tests the C<load_bytecode> operation. + +=cut + +pir_output_like(<<'CODE', <<'OUTPUT', "load_bytecode on directory"); +.sub main :main + load_bytecode 't' +.end +CODE +/t' is a directory/ +OUTPUT + +pir_output_like(<<'CODE', <<'OUTPUT', "load_bytecode on non-existent file"); +.sub main :main + load_bytecode 'no_file_by_this_name' +.end +CODE +/Couldn't find file 'no_file_by_this_name'/ +OUTPUT Property changes on: t/op/load_bytecode.t ___________________________________________________________________ Name: svn:mime-type +text/plain