aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/zwobble/couscous/tests/backends/python
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-01-08 08:42:49 +0000
committerMichael Williamson <mike@zwobble.org>2016-01-08 08:42:49 +0000
commit0577f8637123c92fa6c1d4e27e0d2281c9a6b519 (patch)
treeedaa735a2582030b1d6da5a66eef15e90bcc40bc /src/test/java/org/zwobble/couscous/tests/backends/python
parent17072b4d14dad00acac247508e35b52c0233170b (diff)
Use list() to create lists of fixed size
Diffstat (limited to 'src/test/java/org/zwobble/couscous/tests/backends/python')
-rw-r--r--src/test/java/org/zwobble/couscous/tests/backends/python/PythonCompilerEvalTests.java5
-rw-r--r--src/test/java/org/zwobble/couscous/tests/backends/python/PythonSerializerTests.java17
2 files changed, 12 insertions, 10 deletions
diff --git a/src/test/java/org/zwobble/couscous/tests/backends/python/PythonCompilerEvalTests.java b/src/test/java/org/zwobble/couscous/tests/backends/python/PythonCompilerEvalTests.java
index c5c7aab..61f5c38 100644
--- a/src/test/java/org/zwobble/couscous/tests/backends/python/PythonCompilerEvalTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/backends/python/PythonCompilerEvalTests.java
@@ -10,6 +10,7 @@ import org.zwobble.couscous.values.PrimitiveValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import static java.util.Arrays.asList;
+import static org.zwobble.couscous.util.ExtraLists.list;
public class PythonCompilerEvalTests extends BackendEvalTests {
@Override
@@ -23,9 +24,9 @@ public class PythonCompilerEvalTests extends BackendEvalTests {
return runner.runMethod(
ImmutableList.copyOf(Iterables.concat(
classes,
- asList(programNode))),
+ list(programNode))),
programNode.getName(),
"run",
- ImmutableList.of());
+ list());
}
} \ No newline at end of file
diff --git a/src/test/java/org/zwobble/couscous/tests/backends/python/PythonSerializerTests.java b/src/test/java/org/zwobble/couscous/tests/backends/python/PythonSerializerTests.java
index 9411d3e..59ab22c 100644
--- a/src/test/java/org/zwobble/couscous/tests/backends/python/PythonSerializerTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/backends/python/PythonSerializerTests.java
@@ -26,6 +26,7 @@ import static org.zwobble.couscous.backends.python.ast.PythonReturnNode.pythonRe
import static org.zwobble.couscous.backends.python.ast.PythonStringLiteralNode.pythonStringLiteral;
import static org.zwobble.couscous.backends.python.ast.PythonVariableReferenceNode.pythonVariableReference;
import static org.zwobble.couscous.backends.python.ast.PythonWhileNode.pythonWhile;
+import static org.zwobble.couscous.util.ExtraLists.list;
public class PythonSerializerTests {
@Test
@@ -69,12 +70,12 @@ public class PythonSerializerTests {
@Test
public void callIsSerializedUsingParenthesisedSubExpression() {
- assertEquals("(f)(x, y)", serialize(pythonCall(pythonVariableReference("f"), asList(pythonVariableReference("x"), pythonVariableReference("y")))));
+ assertEquals("(f)(x, y)", serialize(pythonCall(pythonVariableReference("f"), list(pythonVariableReference("x"), pythonVariableReference("y")))));
}
@Test
public void getSliceIsSerializedUsingParenthesisedSubExpression() {
- assertEquals("(x)[y:z]", serialize(pythonGetSlice(pythonVariableReference("x"), asList(pythonVariableReference("y"), pythonVariableReference("z")))));
+ assertEquals("(x)[y:z]", serialize(pythonGetSlice(pythonVariableReference("x"), list(pythonVariableReference("y"), pythonVariableReference("z")))));
}
@Test
@@ -148,7 +149,7 @@ public class PythonSerializerTests {
public void importIsSerializedUsingImportKeyword() {
String output = serialize(pythonImport(
"com.example",
- asList(pythonImportAlias("Program"))));
+ list(pythonImportAlias("Program"))));
assertEquals("from com.example import Program\n", output);
}
@@ -156,7 +157,7 @@ public class PythonSerializerTests {
public void importAliasesAreSeparatedByCommas() {
String output = serialize(pythonImport(
"com.example",
- asList(pythonImportAlias("Program"),pythonImportAlias("Runner"))));
+ list(pythonImportAlias("Program"),pythonImportAlias("Runner"))));
assertEquals("from com.example import Program, Runner\n", output);
}
@@ -164,8 +165,8 @@ public class PythonSerializerTests {
public void ifStatementIsSerializedWithIfKeyword() {
String output = serialize(pythonIfStatement(
pythonBooleanLiteral(true),
- asList(pythonReturn(pythonIntegerLiteral(1))),
- asList(pythonReturn(pythonIntegerLiteral(2)))));
+ list(pythonReturn(pythonIntegerLiteral(1))),
+ list(pythonReturn(pythonIntegerLiteral(2)))));
assertEquals("if True:\n return 1\nelse:\n return 2\n", output);
}
@@ -173,13 +174,13 @@ public class PythonSerializerTests {
public void whileIsSerializedWithWhileKeyword() {
String output = serialize(pythonWhile(
pythonBooleanLiteral(true),
- asList(pythonReturn(pythonIntegerLiteral(1)))));
+ list(pythonReturn(pythonIntegerLiteral(1)))));
assertEquals("while True:\n return 1\n", output);
}
@Test
public void moduleIsSerializedStatements() {
- PythonModuleNode classNode = pythonModule(asList(PASS));
+ PythonModuleNode classNode = pythonModule(list(PASS));
String output = serialize(classNode);
assertEquals("pass\n", output);
}