kindlich před 4 roky
rodič
revize
6b718fa47e
No known key found for this signature in database

+ 1
- 1
ScriptingExample/src/main/java/org/openzen/zenscript/scriptingexample/Main.java Zobrazit soubor

@@ -36,7 +36,7 @@ public class Main {
36 36
                 .filter(File::isFile)
37 37
                 .filter(f -> f.getName().endsWith(".zs"))
38 38
                 .filter(f -> !f.getAbsolutePath().contains("nope"))
39
-                .map(f -> new FileSourceFile(f.getName(), f))
39
+                .map(f -> new FileSourceFile(f.getAbsolutePath().substring(inputDirectory.getAbsolutePath().length() + 1), f))
40 40
                 .toArray(SourceFile[]::new);
41 41
         
42 42
         final PrefixedBracketParser parser = new PrefixedBracketParser(null);

+ 28
- 0
ScriptingExample/src/test/java/org/openzen/zenscript/scriptingexample/tests/actual_test/arrays/ArrayOperators.java Zobrazit soubor

@@ -0,0 +1,28 @@
1
+package org.openzen.zenscript.scriptingexample.tests.actual_test.arrays;
2
+
3
+import org.junit.jupiter.api.*;
4
+import org.openzen.zenscript.scriptingexample.tests.helpers.*;
5
+
6
+public class ArrayOperators extends ZenCodeTest {
7
+    @Test
8
+    public void containsReturnsTrueForMatch() {
9
+        ScriptBuilder.create()
10
+                .add("var array = ['a', 'b', 'c'] as string[];")
11
+                .add("println(('a' in array) as string);")
12
+                .execute(this);
13
+        
14
+        logger.assertPrintOutputSize(1);
15
+        logger.assertPrintOutput(0, "true");
16
+    }
17
+    
18
+    @Test
19
+    public void containsReturnsFalseForNonMatch() {
20
+        ScriptBuilder.create()
21
+                .add("var array = ['a', 'b', 'c'] as string[];")
22
+                .add("println(('d' in array) as string);")
23
+                .execute(this);
24
+        
25
+        logger.assertPrintOutputSize(1);
26
+        logger.assertPrintOutput(0, "false");
27
+    }
28
+}

+ 16
- 0
ScriptingExample/src/test/java/org/openzen/zenscript/scriptingexample/tests/actual_test/expansions/StringExpansions.java Zobrazit soubor

@@ -0,0 +1,16 @@
1
+package org.openzen.zenscript.scriptingexample.tests.actual_test.expansions;
2
+
3
+import org.junit.jupiter.api.*;
4
+import org.openzen.zenscript.scriptingexample.tests.helpers.*;
5
+
6
+public class StringExpansions extends ZenCodeTest {
7
+    @Test
8
+    public void toUpperCaseMethod() {
9
+        ScriptBuilder.create()
10
+                .add("println('hello world'.toUpperCase());")
11
+                .execute(this);
12
+    
13
+        logger.assertPrintOutputSize(1);
14
+        logger.assertPrintOutput(0, "Hello World".toUpperCase());
15
+    }
16
+}

Loading…
Zrušit
Uložit