Skip to content

Commit

Permalink
Merge branch 'leto/embed_grant'
Browse files Browse the repository at this point in the history
  • Loading branch information
leto committed Jun 7, 2011
2 parents e161100 + 2a51d1e commit 5e12529
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
4 changes: 4 additions & 0 deletions t/src/embed/api.t
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ int main(void) {
imcc_compile_file_api(interp, pir_compiler, filename, &bytecode);
Parrot_api_run_bytecode(interp, bytecode, NULL);
Parrot_api_set_warnings(interp, 0);
Parrot_api_add_library_search_path(interp, ".");
Parrot_api_add_dynext_search_path(interp, ".");
Parrot_api_string_import_ascii(interp, "Pi->", &signature_s);
Parrot_api_string_import_ascii(interp, "CallContext", &callcontext_s);
Expand Down
56 changes: 53 additions & 3 deletions t/src/extend.t
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!perl
# Copyright (C) 2001-2010, Parrot Foundation.
# Copyright (C) 2001-2011, Parrot Foundation.

use strict;
use warnings;
Expand All @@ -14,7 +14,7 @@ use File::Spec::Functions;

plan skip_all => 'src/parrot_config.o does not exist' unless -e catfile(qw/src parrot_config.o/);

plan tests => 18;
plan tests => 20;

=head1 NAME
Expand All @@ -30,9 +30,59 @@ Tests the extension API.
=cut

c_output_is( <<'CODE', <<'OUTPUT', 'Parrot_PMC_null' );
#include <stdio.h>
#include "parrot/embed.h"
#include "parrot/extend.h"
c_output_is( <<'CODE', <<'OUTPUT', 'set/get_intreg' );
int
main(int argc, const char *argv[])
{
Parrot_Interp interp = Parrot_new(NULL);
Parrot_PMC pmcnull;
/* Interpreter set-up */
if (interp) {
pmcnull = Parrot_PMC_null();
Parrot_destroy(interp);
}
return 0;
}
CODE
OUTPUT


c_output_is( <<'CODE', <<'OUTPUT', 'Parrot_get_root_namespace/Parrot_(un)register_(pmc|string)' );
#include <stdio.h>
#include "parrot/embed.h"
#include "parrot/extend.h"
int
main(int argc, const char *argv[])
{
Parrot_Interp interp = Parrot_new(NULL);
Parrot_PMC ns;
Parrot_String string;
/* Interpreter set-up */
if (interp) {
ns = Parrot_get_root_namespace(interp);
Parrot_register_pmc(interp, ns);
Parrot_unregister_pmc(interp, ns);
Parrot_register_string(interp, string);
Parrot_unregister_string(interp, string);
Parrot_printf(interp,"%P\n", ns);
Parrot_destroy(interp);
}
return 0;
}
CODE

OUTPUT

c_output_is( <<'CODE', <<'OUTPUT', 'set/get_intreg' );
#include <stdio.h>
#include "parrot/embed.h"
#include "parrot/extend.h"
Expand Down

0 comments on commit 5e12529

Please sign in to comment.