blob: 3976e4b0d74e4e4bcb4f6a5b07bab80c565acde3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package org.zwobble.couscous.tests.backends.python;
import org.junit.Test;
import org.zwobble.couscous.backends.python.PythonCodeGenerator;
import org.zwobble.couscous.types.Types;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.zwobble.couscous.ast.ArrayNode.array;
import static org.zwobble.couscous.ast.LiteralNode.literal;
import static org.zwobble.couscous.tests.backends.python.PythonNodeMatchers.isPythonList;
import static org.zwobble.couscous.tests.backends.python.PythonNodeMatchers.isPythonLiteral;
import static org.zwobble.couscous.util.ExtraLists.list;
public class PythonCodeGeneratorTests {
@Test
public void arrayIsConvertedToPythonList() {
assertThat(
PythonCodeGenerator.generateExpression(array(Types.STRING, list(
literal("one"),
literal("two")))),
isPythonList(list(isPythonLiteral("one"), isPythonLiteral("two"))));
}
}
|