Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.sl.test/src/com/oracle/truffle/sl/test/SLTckTest.java @ 21490:3286fb5fea4a
Introducing standard I/O and error into Env and using TruffleVM to execute SL test cases. Adding SLTckTest to verify SL language interop.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Tue, 26 May 2015 19:11:36 +0200 |
parents | |
children | ed234a3178af e59895e16377 |
comparison
equal
deleted
inserted
replaced
21489:b3f1d8b23037 | 21490:3286fb5fea4a |
---|---|
1 /* | |
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.truffle.sl.test; | |
24 | |
25 import com.oracle.truffle.api.test.vm.TruffleTCK; | |
26 import com.oracle.truffle.api.vm.TruffleVM; | |
27 import static org.junit.Assert.*; | |
28 import org.junit.Test; | |
29 | |
30 /** | |
31 * This is the way to verify your language implementation is compatible. | |
32 * | |
33 */ | |
34 public class SLTckTest extends TruffleTCK { | |
35 @Test | |
36 public void testVerifyPresence() { | |
37 TruffleVM vm = TruffleVM.newVM().build(); | |
38 assertTrue("Our language is present", vm.getLanguages().containsKey("application/x-sl")); | |
39 } | |
40 | |
41 @Override | |
42 protected TruffleVM prepareVM() throws Exception { | |
43 TruffleVM vm = TruffleVM.newVM().build(); | |
44 vm.eval("application/x-sl", // your langage | |
45 "function fourtyTwo() {\n" + // your script | |
46 " return 42;\n" + // | |
47 "}\n" + // | |
48 "function plus(a, b) {\n" + // | |
49 " return a + b;\n" + // | |
50 "}\n" // | |
51 ); | |
52 return vm; | |
53 } | |
54 | |
55 @Override | |
56 protected String fourtyTwo() { | |
57 return "fourtyTwo"; | |
58 } | |
59 | |
60 @Override | |
61 protected String plusInt() { | |
62 return "plus"; | |
63 } | |
64 } |