[svn:parrot] r36652 - trunk/t/src
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Thu Feb 12 23:25:25 UTC 2009
Author: NotFound
Date: Thu Feb 12 23:25:25 2009
New Revision: 36652
URL: https://trac.parrot.org/parrot/changeset/36652
Log:
[test] test something in embed.t
Modified:
trunk/t/src/embed.t
Modified: trunk/t/src/embed.t
==============================================================================
--- trunk/t/src/embed.t Thu Feb 12 23:04:12 2009 (r36651)
+++ trunk/t/src/embed.t Thu Feb 12 23:25:25 2009 (r36652)
@@ -1,5 +1,5 @@
#! perl
-# Copyright (C) 2001-2008, The Perl Foundation.
+# Copyright (C) 2001-2009, The Perl Foundation.
# $Id$
use strict;
@@ -8,23 +8,63 @@
use Test::More;
use Parrot::Test;
-plan skip_all => 'TT #306; many symbols not exported, embedding parrot fails';
+plan tests => 2;
=head1 NAME
-t/src/compiler.t - Compile and run a PIR program from C.
+t/src/embed.t - Embedding parrot
=head1 SYNOPSIS
- % prove t/src/compiler.t
+ % prove t/src/embed.t
=head1 DESCRIPTION
-Show steps to run a program from C. Functionality should be
-gathered in some API calls..
+Embedding parrot in C
=cut
+c_output_is( <<'CODE', <<'OUTPUT', "Hello world" );
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "parrot/embed.h"
+#include "parrot/extend.h"
+
+void fail(const char *msg);
+
+void fail(const char *msg)
+{
+ fprintf(stderr, "failed: %s\n", msg);
+ exit(EXIT_FAILURE);
+}
+
+int main(void)
+{
+ Parrot_Interp interp;
+ interp = Parrot_new(NULL);
+ if (! interp)
+ fail("Cannot create parrot interpreter");
+
+ Parrot_printf(interp, "Hello, parrot\n");
+
+ Parrot_exit(interp, 0);
+ return 0;
+}
+CODE
+Hello, parrot
+OUTPUT
+
+
+# Old tests, skipped al
+
+SKIP: {
+
+ skip('TT #306; many symbols not exported, embedding parrot fails', 1);
+
+########################################################################
+
c_output_is( <<'CODE', <<'OUTPUT', "Parrot Compile API Single call" );
#include <stdio.h>
@@ -467,6 +507,8 @@
Pir compiler returned no prog
OUTPUT
+}
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
More information about the parrot-commits
mailing list