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