-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
case _ of Vector.Vector_Data works again
- Loading branch information
1 parent
0c5a44c
commit aa17c2b
Showing
10 changed files
with
77 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,3 @@ protected List<Cons> getDeclaredConstructors() { | |
return List.of(new Cons("Vector_Data")); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
engine/runtime/src/test/java/org/enso/interpreter/test/VectorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package org.enso.interpreter.test; | ||
|
||
import java.net.URI; | ||
import java.nio.file.Paths; | ||
import java.util.Map; | ||
import org.enso.polyglot.RuntimeOptions; | ||
import org.graalvm.polyglot.Context; | ||
import org.graalvm.polyglot.Engine; | ||
import org.graalvm.polyglot.Language; | ||
import org.graalvm.polyglot.Source; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import org.junit.Test; | ||
|
||
public class VectorTest { | ||
@Test | ||
public void evaluation() throws Exception { | ||
Engine eng = Engine.newBuilder() | ||
.allowExperimentalOptions(true) | ||
.option( | ||
RuntimeOptions.LANGUAGE_HOME_OVERRIDE, | ||
Paths.get("../../distribution/component").toFile().getAbsolutePath() | ||
).build(); | ||
Context ctx = Context.newBuilder() | ||
.engine(eng) | ||
.allowIO(true) | ||
.allowAllAccess(true) | ||
.build(); | ||
final Map<String, Language> langs = ctx.getEngine().getLanguages(); | ||
assertNotNull("Enso found: " + langs, langs.get("enso")); | ||
|
||
final URI facUri = new URI("memory://choose.enso"); | ||
final Source facSrc = Source.newBuilder("enso", """ | ||
import Standard.Base.Data.Vector | ||
choose x = case x of | ||
Vector.Vector_Data -> "is vector" | ||
_ -> "nothing" | ||
check = choose [1, 2, 3] | ||
""", "choose.enso") | ||
.uri(facUri) | ||
.buildLiteral(); | ||
|
||
var module = ctx.eval(facSrc); | ||
var res = module.invokeMember("eval_expression", "check"); | ||
assertEquals("is vector", res.asString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters