diff truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.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 503529c65456
children e70b20f4bb00
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java	Mon Aug 24 08:25:31 2015 +0200
+++ b/truffle/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java	Mon Aug 24 08:46:21 2015 +0200
@@ -40,6 +40,7 @@
  */
 package com.oracle.truffle.sl.test;
 
+import com.oracle.truffle.api.source.Source;
 import com.oracle.truffle.tck.TruffleTCK;
 import com.oracle.truffle.api.vm.TruffleVM;
 import static org.junit.Assert.*;
@@ -60,26 +61,28 @@
     protected TruffleVM prepareVM() throws Exception {
         TruffleVM vm = TruffleVM.newVM().build();
         // @formatter:off
-        vm.eval("application/x-sl",
-            "function fourtyTwo() {\n" +
-            "  return 42;\n" + //
-            "}\n" +
-            "function plus(a, b) {\n" +
-            "  return a + b;\n" +
-            "}\n" +
-            "function apply(f) {\n" +
-            "  return f(18, 32) + 10;\n" +
-            "}\n" +
-            "function cnt() {\n" +
-            "  return 0;\n" +
-            "}\n" +
-            "function count() {\n" +
-            "  n = cnt() + 1;\n" +
-            "  defineFunction(\"function cnt() { return \" + n + \"; }\");\n" +
-            "  return n;\n" +
-            "}\n" +
-            "function null() {\n" +
-            "}\n"
+        vm.eval(
+            Source.fromText(
+                "function fourtyTwo() {\n" +
+                "  return 42;\n" + //
+                "}\n" +
+                "function plus(a, b) {\n" +
+                "  return a + b;\n" +
+                "}\n" +
+                "function apply(f) {\n" +
+                "  return f(18, 32) + 10;\n" +
+                "}\n" +
+                "function cnt() {\n" +
+                "  return 0;\n" +
+                "}\n" +
+                "function count() {\n" +
+                "  n = cnt() + 1;\n" +
+                "  defineFunction(\"function cnt() { return \" + n + \"; }\");\n" +
+                "  return n;\n" +
+                "}\n" +
+                "function null() {\n" +
+                "}\n", "SL TCK"
+            ).withMimeType("application/x-sl")
         );
         // @formatter:on
         return vm;