Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/vm/ExceptionDuringParsingTest.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 | ff531952a91c |
children | dc83cc1f94f2 ffadd23c63c8 |
comparison
equal
deleted
inserted
replaced
22103:7646278cca8a | 22104:cf19259edf87 |
---|---|
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.truffle.api.test.vm; | 23 package com.oracle.truffle.api.test.vm; |
24 | 24 |
25 import com.oracle.truffle.api.impl.Accessor; | 25 import com.oracle.truffle.api.impl.Accessor; |
26 import com.oracle.truffle.api.source.Source; | |
26 import static com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.L1; | 27 import static com.oracle.truffle.api.test.vm.ImplicitExplicitExportTest.L1; |
27 import com.oracle.truffle.api.vm.TruffleVM; | 28 import com.oracle.truffle.api.vm.TruffleVM; |
28 import java.io.IOException; | 29 import java.io.IOException; |
29 import static org.junit.Assert.*; | 30 import static org.junit.Assert.*; |
30 import org.junit.Test; | 31 import org.junit.Test; |
37 TruffleVM vm = TruffleVM.newVM().build(); | 38 TruffleVM vm = TruffleVM.newVM().build(); |
38 TruffleVM.Language language = vm.getLanguages().get(L1); | 39 TruffleVM.Language language = vm.getLanguages().get(L1); |
39 assertNotNull("L1 language is defined", language); | 40 assertNotNull("L1 language is defined", language); |
40 | 41 |
41 try { | 42 try { |
42 vm.eval(L1, "parse=No, no, no!"); | 43 vm.eval(Source.fromText("parse=No, no, no!", "Fail on parsing").withMimeType(L1)); |
43 fail("Exception thrown"); | 44 fail("Exception thrown"); |
44 } catch (IOException ex) { | 45 } catch (IOException ex) { |
45 assertEquals(ex.getMessage(), "No, no, no!"); | 46 assertEquals(ex.getMessage(), "No, no, no!"); |
46 } | 47 } |
47 } | 48 } |