[svn:parrot] r46240 - trunk/t/src
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Mon May 3 17:37:33 UTC 2010
Author: NotFound
Date: Mon May 3 17:37:33 2010
New Revision: 46240
URL: https://trac.parrot.org/parrot/changeset/46240
Log:
fix embed compile string error test for C++ buildability and parrot internal correctness, and place it after a simpler test
Modified:
trunk/t/src/embed.t
Modified: trunk/t/src/embed.t
==============================================================================
--- trunk/t/src/embed.t Mon May 3 17:03:35 2010 (r46239)
+++ trunk/t/src/embed.t Mon May 3 17:37:33 2010 (r46240)
@@ -32,9 +32,11 @@
return "#line " . $linenum . ' "' . __FILE__ . '"' . "\n";
}
-c_output_is(linedirective(__LINE__) . <<'CODE', <<'OUTPUT', 'Parrot_compile_string populates the error string when an opcode is given improper arguments');
+c_output_is(linedirective(__LINE__) . <<'CODE', <<'OUTPUT', "Minimal embed, using just the embed.h header" );
+
+#include <stdio.h>
+#include <stdlib.h>
-#include "parrot/parrot.h"
#include "parrot/embed.h"
void fail(const char *msg);
@@ -45,36 +47,27 @@
exit(EXIT_FAILURE);
}
-
int main(int argc, const char **argv)
{
Parrot_Interp interp;
- Parrot_String err, lang;
- Parrot_PMC func_pmc;
- char *str;
-
interp = Parrot_new(NULL);
if (! interp)
fail("Cannot create parrot interpreter");
- lang = Parrot_str_new_constant(interp, "PIR");
- func_pmc = Parrot_compile_string(interp, lang, ".sub foo\n copy\n.end", &err);
- str = Parrot_str_to_cstring(interp, err);
- puts(str);
- Parrot_str_free_cstring(str);
+ puts("Done");
Parrot_destroy(interp);
return 0;
}
CODE
-The opcode 'copy' (copy<0>) was not found. Check the type and number of the arguments
+Done
OUTPUT
-c_output_is(linedirective(__LINE__) . <<'CODE', <<'OUTPUT', "Minimal embed, using just the embed.h header" );
+c_output_is(linedirective(__LINE__) . <<'CODE', <<'OUTPUT', 'Parrot_compile_string populates the error string when an opcode is given improper arguments');
#include <stdio.h>
#include <stdlib.h>
-
#include "parrot/embed.h"
+#include "parrot/extend.h"
void fail(const char *msg);
@@ -84,19 +77,26 @@
exit(EXIT_FAILURE);
}
+
int main(int argc, const char **argv)
{
Parrot_Interp interp;
+ Parrot_String err, lang;
+ Parrot_PMC func_pmc;
+ char *str;
+
interp = Parrot_new(NULL);
if (! interp)
fail("Cannot create parrot interpreter");
+ lang = Parrot_new_string(interp, "PIR", 3, (const char*)NULL, 0);
- puts("Done");
+ func_pmc = Parrot_compile_string(interp, lang, ".sub foo\n copy\n.end", &err);
+ Parrot_printf(interp, "%Ss\n", err);
Parrot_destroy(interp);
return 0;
}
CODE
-Done
+The opcode 'copy' (copy<0>) was not found. Check the type and number of the arguments
OUTPUT
c_output_is(linedirective(__LINE__) . <<'CODE', <<'OUTPUT', "Hello world from main" );
More information about the parrot-commits
mailing list