Skip to content

Commit

Permalink
Finish individual tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Moderocky committed Mar 20, 2022
1 parent a1fa85e commit 49f5f00
Show file tree
Hide file tree
Showing 42 changed files with 156 additions and 1,696 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TestTree extends ProgrammaticSplitTree {
private final SectionMeta owner;
private final MultiLabel end = new MultiLabel();
private boolean open;
private Label next = new Label();
private final Label next = new Label();

public TestTree(SectionMeta owner) {
this.owner = owner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@
import org.byteskript.skript.compiler.Context;
import org.byteskript.skript.compiler.Pattern;
import org.byteskript.skript.compiler.SkriptLangSpec;
import org.byteskript.skript.compiler.structure.MultiLabel;
import org.byteskript.skript.compiler.structure.ProgrammaticSplitTree;
import org.byteskript.skript.compiler.structure.TestTree;
import org.byteskript.skript.compiler.structure.TryCatchTree;
import org.byteskript.skript.error.ScriptCompileError;
import org.byteskript.skript.lang.element.StandardElements;
import org.byteskript.skript.runtime.internal.ExtractedSyntaxCalls;
import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;

@Documentation(
name = "Inline Test",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import mx.kenzie.foundation.compiler.State;
import org.byteskript.skript.api.note.Documentation;
import org.byteskript.skript.api.syntax.SimpleEntry;
import org.byteskript.skript.compiler.*;
import org.byteskript.skript.compiler.CompileState;
import org.byteskript.skript.compiler.Context;
import org.byteskript.skript.compiler.Pattern;
import org.byteskript.skript.compiler.SkriptLangSpec;
import org.byteskript.skript.lang.element.StandardElements;

@Documentation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ public static Object getListValue(Object key, Object target) {
throw new ScriptRuntimeError("The given collection must be a list.");
}

public static Object getMapValue(Object key, Object target) {
if (!(target instanceof Map map))
throw new ScriptRuntimeError("The given collection must be a map.");
return map.get(key);
}

@SuppressWarnings("unchecked")
public static void setListValue(Object key, Object target, Object value) {
if (target instanceof Map) setMapValue(key, target, value);
Expand All @@ -143,6 +149,12 @@ public static void setListValue(Object key, Object target, Object value) {
throw new ScriptRuntimeError("The given collection must be a list.");
}

public static void setMapValue(Object key, Object target, Object value) {
if (!(target instanceof Map map))
throw new ScriptRuntimeError("The given collection must be a map.");
map.put(key, value);
}

public static void deleteListValue(Object key, Object target) {
if (target instanceof Map) deleteMapValue(key, target);
final Number number = Skript.convert(key, Number.class);
Expand All @@ -156,18 +168,6 @@ public static void deleteListValue(Object key, Object target) {
throw new ScriptRuntimeError("The given collection must be a list.");
}

public static Object getMapValue(Object key, Object target) {
if (!(target instanceof Map map))
throw new ScriptRuntimeError("The given collection must be a map.");
return map.get(key);
}

public static void setMapValue(Object key, Object target, Object value) {
if (!(target instanceof Map map))
throw new ScriptRuntimeError("The given collection must be a map.");
map.put(key, value);
}

public static void deleteMapValue(Object key, Object target) {
if (!(target instanceof Map map))
throw new ScriptRuntimeError("The given collection must be a map.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public class AsyncCompileTest {

@BeforeClass
public static void warm() throws Throwable {
code = new String(GenericTest.class.getClassLoader()
.getResourceAsStream("generic.bsk").readAllBytes());
code = new String(SyntaxTest.class.getClassLoader()
.getResourceAsStream("tests/typemember.bsk").readAllBytes());
final PostCompileClass cls = skript.compileScript(code, "skript.test");
final PostCompileClass second = skript.compileScriptAsync(code, "skript.test").get()[0];
}
Expand Down
6 changes: 0 additions & 6 deletions src/test/java/org/byteskript/skript/test/ConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@

package org.byteskript.skript.test;

import mx.kenzie.foundation.language.PostCompileClass;
import org.byteskript.skript.lang.syntax.config.ConfigFile;
import org.byteskript.skript.runtime.Script;
import org.byteskript.skript.runtime.Skript;
import org.byteskript.skript.runtime.config.ConfigEntry;
import org.byteskript.skript.runtime.config.ConfigMap;
import org.byteskript.skript.runtime.internal.Member;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.ByteArrayInputStream;
Expand Down
38 changes: 0 additions & 38 deletions src/test/java/org/byteskript/skript/test/DictionaryTest.java

This file was deleted.

86 changes: 0 additions & 86 deletions src/test/java/org/byteskript/skript/test/ErrorHandlingTest.java

This file was deleted.

31 changes: 0 additions & 31 deletions src/test/java/org/byteskript/skript/test/EventTest.java

This file was deleted.

32 changes: 0 additions & 32 deletions src/test/java/org/byteskript/skript/test/EveryTest.java

This file was deleted.

70 changes: 0 additions & 70 deletions src/test/java/org/byteskript/skript/test/FlowTest.java

This file was deleted.

Loading

0 comments on commit 49f5f00

Please sign in to comment.