Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@

import com.laytonsmith.PureUtilities.ClassLoading.ClassDiscovery;
import com.laytonsmith.PureUtilities.Common.ReflectionUtils;
import com.laytonsmith.testing.StaticTest;
import com.laytonsmith.testing.AbstractIntegrationTest;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;

/**
*
*
*/
public class ReflectionUtilsTest {
public class ReflectionUtilsTest extends AbstractIntegrationTest {

public ReflectionUtilsTest() {
}

@Before
public void setUp() {
StaticTest.InstallFakeServerFrontend();
}

class A {

B bObj = new B();
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/com/laytonsmith/core/CodeTargetTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.functions.StringHandling;
import com.laytonsmith.testing.StaticTest;
import com.laytonsmith.testing.AbstractIntegrationTest;
import java.io.File;
import java.util.List;
import static org.junit.Assert.fail;
Expand All @@ -14,12 +14,11 @@
/**
* This class tests various scripts that have historically been shown to have incorrect code targets.
*/
public class CodeTargetTest {
public class CodeTargetTest extends AbstractIntegrationTest {

private static final File TEST_FILE = new File("test.ms");

private List<ParseTree> compile(String script) throws Exception {
StaticTest.InstallFakeServerFrontend();
Environment env = Static.GenerateStandaloneEnvironment();
File file = TEST_FILE;
TokenStream stream = MethodScriptCompiler.lex(script, env, file, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigCompileGroupException;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import com.laytonsmith.testing.AbstractIntegrationTest;
import com.laytonsmith.testing.StaticTest;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

Expand Down Expand Up @@ -61,7 +61,7 @@
//@RunWith(PowerMockRunner.class)
//@PrepareForTest(CommandHelperPlugin.class)
//@PowerMockIgnore({"javax.xml.parsers.*", "com.sun.org.apache.xerces.internal.jaxp.*"})
public class MethodScriptCompilerTest {
public class MethodScriptCompilerTest extends AbstractIntegrationTest {

MCServer fakeServer;
MCPlayer fakePlayer;
Expand All @@ -72,11 +72,6 @@ public MethodScriptCompilerTest() {
//StaticTest.InstallFakeServerFrontend();
}

@BeforeClass
public static void setUpClass() throws Exception {
StaticTest.InstallFakeServerFrontend();
}

@AfterClass
public static void tearDownClass() throws Exception {
new File("profiler.config").deleteOnExit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import com.laytonsmith.core.exceptions.AbstractCompileException;
import com.laytonsmith.core.exceptions.CRE.CRECastException;
import com.laytonsmith.core.functions.Exceptions;
import com.laytonsmith.testing.AbstractIntegrationTest;
import com.laytonsmith.testing.StaticTest;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

Expand All @@ -28,15 +28,10 @@
/**
*
*/
public class NewExceptionHandlingTest {
public class NewExceptionHandlingTest extends AbstractIntegrationTest {

static Set<Class<? extends Environment.EnvironmentImpl>> envs = Environment.getDefaultEnvClasses();

@BeforeClass
public static void setUpClass() {
StaticTest.InstallFakeServerFrontend();
}

public String optimize(String script) throws Exception {
return OptimizationUtilities.optimize(script, null, envs, null, true, true);
}
Expand Down
10 changes: 2 additions & 8 deletions src/test/java/com/laytonsmith/core/OptimizationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigCompileGroupException;
import com.laytonsmith.testing.StaticTest;
import com.laytonsmith.testing.AbstractIntegrationTest;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -17,24 +17,18 @@
import org.junit.Assert;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.BeforeClass;
import org.junit.Test;

/**
* This class tests optimizations by looking at the tree after optimization occurs to see if it matches expectation.
*
* This is also used to test the lexer/compiler at a low level
*/
public class OptimizationTest {
public class OptimizationTest extends AbstractIntegrationTest {

static Set<Class<? extends Environment.EnvironmentImpl>> envs = Environment.getDefaultEnvClasses();
static Environment env;

@BeforeClass
public static void setUpClass() {
StaticTest.InstallFakeServerFrontend();
}

public static String optimize(String script, boolean pureMethodScript, Environment env) throws Exception {
try {
try {
Expand Down
10 changes: 3 additions & 7 deletions src/test/java/com/laytonsmith/core/StaticAnalysisTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,20 @@
import com.laytonsmith.core.environments.RuntimeMode;
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.ConfigCompileGroupException;
import com.laytonsmith.testing.StaticTest;
import com.laytonsmith.testing.AbstractIntegrationTest;

import java.io.File;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashSet;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

/**
*
*/
public class StaticAnalysisTest {
@BeforeClass
public static void beforeClass() {
StaticTest.InstallFakeServerFrontend();
}
public class StaticAnalysisTest extends AbstractIntegrationTest {

public void runScript(String script) throws Exception {
runScript(script, null);
Expand Down
3 changes: 2 additions & 1 deletion src/test/java/com/laytonsmith/core/TestStatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.laytonsmith.core.constructs.CString;
import com.laytonsmith.core.constructs.Target;
import com.laytonsmith.core.exceptions.ConfigRuntimeException;
import com.laytonsmith.testing.AbstractIntegrationTest;
import com.laytonsmith.testing.C;
import org.junit.AfterClass;
import static org.junit.Assert.assertEquals;
Expand All @@ -23,7 +24,7 @@
*
*
*/
public class TestStatic {
public class TestStatic extends AbstractIntegrationTest {

Target t = Target.UNKNOWN;

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/laytonsmith/core/VarargTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.laytonsmith.abstraction.MCPlayer;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.exceptions.CRE.CRECastException;
import com.laytonsmith.testing.AbstractIntegrationTest;
import com.laytonsmith.core.exceptions.ConfigCompileException;
import static com.laytonsmith.testing.StaticTest.*;
import org.junit.Before;
Expand All @@ -12,14 +13,13 @@
/**
*
*/
public class VarargTest {
public class VarargTest extends AbstractIntegrationTest {

Environment env;
MCPlayer fakePlayer;

@Before
public void setup() throws Exception {
InstallFakeServerFrontend();
env = Static.GenerateStandaloneEnvironment();
fakePlayer = GetOnlinePlayer();
}
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/com/laytonsmith/core/asm/IRMetadataTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.laytonsmith.core.Static;
import com.laytonsmith.core.asm.metadata.IRMetadata.PrototypeBuilder;
import com.laytonsmith.core.environments.CommandHelperEnvironment;
import com.laytonsmith.testing.StaticTest;
import com.laytonsmith.testing.AbstractIntegrationTest;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
Expand All @@ -14,12 +14,11 @@
*
* @author Cailin
*/
public class IRMetadataTest {
public class IRMetadataTest extends AbstractIntegrationTest {

com.laytonsmith.core.environments.Environment env;

public IRMetadataTest() throws Exception {
StaticTest.InstallFakeServerFrontend();
env = Static.GenerateStandaloneEnvironment();
env = env.cloneAndAdd(new CommandHelperEnvironment(), new LLVMEnvironment());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.Set;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.laytonsmith.core.Static;
Expand All @@ -27,17 +26,12 @@
import com.laytonsmith.core.exceptions.ConfigCompileException;
import com.laytonsmith.core.exceptions.CRE.CRECastException;
import com.laytonsmith.core.exceptions.CRE.CREIndexOverflowException;
import com.laytonsmith.testing.StaticTest;
import com.laytonsmith.testing.AbstractIntegrationTest;

public class FunctionSignaturesTest {
public class FunctionSignaturesTest extends AbstractIntegrationTest {

private Environment env;

@BeforeClass
public static void setUpClass() throws Exception {
StaticTest.InstallFakeServerFrontend();
}

@Before
public void setUp() throws Exception {
this.env = Static.GenerateStandaloneEnvironment(false);
Expand Down
11 changes: 2 additions & 9 deletions src/test/java/com/laytonsmith/core/constructs/ClassInfoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,20 @@
import com.laytonsmith.core.natives.interfaces.Mixed;
import com.laytonsmith.core.objects.ObjectModifier;
import com.laytonsmith.core.objects.ObjectType;
import com.laytonsmith.testing.StaticTest;

import com.laytonsmith.testing.AbstractIntegrationTest;
import static org.junit.Assert.fail;

import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;

/**
*
* @author cailin
*/
public class ClassInfoTest {

@Before
public void before() {
StaticTest.InstallFakeServerFrontend();
}
public class ClassInfoTest extends AbstractIntegrationTest {

@Test
public void testAllInterfacesReturnNothingForGetInterfaces() throws Exception {
Expand Down
26 changes: 3 additions & 23 deletions src/test/java/com/laytonsmith/core/constructs/EnumTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,21 @@
import com.laytonsmith.core.FullyQualifiedClassName;
import com.laytonsmith.core.natives.interfaces.MEnumType;
import com.laytonsmith.core.natives.interfaces.MEnumTypeValue;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import com.laytonsmith.testing.AbstractIntegrationTest;

import org.junit.Test;

import static com.laytonsmith.testing.StaticTest.InstallFakeServerFrontend;
import static org.junit.Assert.*;

/**
*
* @author Cailin
*/
public class EnumTest {
public class EnumTest extends AbstractIntegrationTest {

public EnumTest() {
}

@BeforeClass
public static void setUpClass() {
InstallFakeServerFrontend();
}

@AfterClass
public static void tearDownClass() {
}

@Before
public void setUp() {
}

@After
public void tearDown() {
}

@Test(expected = ClassNotFoundException.class)
public void testEnumIsNotFound() throws Exception {
NativeTypeList.getNativeEnum(FullyQualifiedClassName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.natives.interfaces.Booleanish;
import com.laytonsmith.core.natives.interfaces.Mixed;
import com.laytonsmith.testing.AbstractIntegrationTest;

import static com.laytonsmith.testing.StaticTest.InstallFakeServerFrontend;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;

import org.junit.BeforeClass;
import org.junit.Test;

/**
*
*/
public class InstanceofUtilTest {

@BeforeClass
public static void setUpClass() {
InstallFakeServerFrontend();
}
public class InstanceofUtilTest extends AbstractIntegrationTest {

@Test
public void testInstanceofUtil() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.laytonsmith.core.environments.CommandHelperEnvironment;
import com.laytonsmith.core.environments.Environment;
import com.laytonsmith.core.natives.interfaces.Mixed;
import com.laytonsmith.testing.AbstractIntegrationTest;
import com.laytonsmith.testing.StaticTest;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -25,13 +26,12 @@
*
* @author cailin
*/
public class TestCClassType {
public class TestCClassType extends AbstractIntegrationTest {

static Environment env;

@Before
public void load() throws Exception {
StaticTest.InstallFakeServerFrontend();
env = Static.GenerateStandaloneEnvironment(false);
env = env.cloneAndAdd(new CommandHelperEnvironment());
}
Expand Down
Loading