Skip to content

Commit

Permalink
Add Jurst Test
Browse files Browse the repository at this point in the history
  • Loading branch information
Frotty committed Aug 9, 2018
1 parent 010e7f0 commit 657c66a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,6 @@ public void thisAsVarNameInJass() { // #498
testJurstWithJass(true, false, jassCode, jurstCode);
}

@Test
public void testBigJassScript() throws IOException {
String jassCode = new String(Files.readAllBytes(Paths.get(Utils.getResourceFile("test.j"))));

String jurstCode = Utils.string(
"package test",
" init",
" testSuccess()",
" end",
"endpackage");

testJurstWithJass(false, true, jassCode, jurstCode);
}

@Test
public void logicalOperatorPrecedence() { // #641
String jassCode = Utils.string(
Expand Down Expand Up @@ -199,6 +185,32 @@ public void returnDetection() { // #641
testJurstWithJass(true, false, jassCode, jurstCode);
}

@Test
public void testBigJassScript() throws IOException {
String jassCode = new String(Files.readAllBytes(Paths.get(Utils.getResourceFile("test.j"))));

String jurstCode = Utils.string(
"package test",
" init",
" testSuccess()",
" end",
"endpackage");

testJurstWithJass(false, true, jassCode, jurstCode);
}

@Test
public void testJurstWrapping() throws IOException {
String jassCode = Utils.string(
"function foo takes integer a returns string",
" return \" ah \"",
"endfunction");

String jurstCode = new String(Files.readAllBytes(Paths.get(Utils.getResourceFile("test.jurst"))));

testJurstWithJass(false, true, jassCode, jurstCode);
}

private void testJurstWithJass(boolean executeProg, boolean withStdLib, String jass, String jurst) {
Map<String, String> inputs = ImmutableMap.of(
"example.j", jass,
Expand Down
21 changes: 21 additions & 0 deletions de.peeeq.wurstscript/src/test/resources/test.jurst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
library Blub

struct A

method b takes integer i, integer i2 returns nothing
endmethod

endstruct

init
var a = new A()
a.b(1,
2)
let b = new A()
endinit

endlibrary

scope Fuark

endscope

0 comments on commit 657c66a

Please sign in to comment.