|
@@ -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
|
+}
|