diff truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java @ 22104:cf19259edf87

TruffleVM.eval and Source.withMimeType
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Mon, 24 Aug 2015 08:46:21 +0200
parents 1e78795e7e6a
children d045a505c2b3
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java	Mon Aug 24 08:25:31 2015 +0200
+++ b/truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ImplicitExplicitExportTest.java	Mon Aug 24 08:46:21 2015 +0200
@@ -52,11 +52,9 @@
     @Test
     public void explicitExportFound() throws IOException {
         // @formatter:off
-        vm.eval(L1,
-            "explicit.ahoj=42"
-        );
-        Object ret = vm.eval(L3,
-            "return=ahoj"
+        vm.eval(Source.fromText("explicit.ahoj=42", "Fourty two").withMimeType(L1));
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
         );
         // @formatter:on
         assertEquals("42", ret);
@@ -65,11 +63,11 @@
     @Test
     public void implicitExportFound() throws IOException {
         // @formatter:off
-        vm.eval(L1,
-            "implicit.ahoj=42"
+        vm.eval(
+            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1)
         );
-        Object ret = vm.eval(L3,
-            "return=ahoj"
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
         );
         // @formatter:on
         assertEquals("42", ret);
@@ -78,14 +76,14 @@
     @Test
     public void explicitExportPreferred2() throws IOException {
         // @formatter:off
-        vm.eval(L1,
-            "implicit.ahoj=42"
+        vm.eval(
+            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L1)
         );
-        vm.eval(L2,
-            "explicit.ahoj=43"
+        vm.eval(
+            Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L2)
         );
-        Object ret = vm.eval(L3,
-            "return=ahoj"
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
         );
         // @formatter:on
         assertEquals("Explicit import from L2 is used", "43", ret);
@@ -95,14 +93,14 @@
     @Test
     public void explicitExportPreferred1() throws IOException {
         // @formatter:off
-        vm.eval(L1,
-            "explicit.ahoj=43"
+        vm.eval(
+            Source.fromText("explicit.ahoj=43", "Fourty three").withMimeType(L1)
         );
-        vm.eval(L2,
-            "implicit.ahoj=42"
+        vm.eval(
+            Source.fromText("implicit.ahoj=42", "Fourty two").withMimeType(L2)
         );
-        Object ret = vm.eval(L3,
-            "return=ahoj"
+        Object ret = vm.eval(
+            Source.fromText("return=ahoj", "Return").withMimeType(L3)
         );
         // @formatter:on
         assertEquals("Explicit import from L2 is used", "43", ret);