diff options
author | 2017-06-19 12:34:12 -0400 | |
---|---|---|
committer | 2017-06-20 14:35:01 -0400 | |
commit | d3a039b1b755110c3bb8cb249bac4a417a0c693b (patch) | |
tree | e4c7a69e99d96b961ed4cb65020a3e0a382b49a7 /src/test/java/com/google | |
parent | baf7d4bce8bb14d785760d10694122e8ead2a177 (diff) |
Move some Skylark tests out of Java.
RELNOTES: None.
PiperOrigin-RevId: 159436969
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java index dc2d021bdb..a3251da4f3 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/EvaluationTest.java @@ -72,126 +72,6 @@ public class EvaluationTest extends EvaluationTestCase { } @Test - public void testAndOr() throws Exception { - new BuildTest() - .testStatement("8 or 9", 8) - .testStatement("0 or 9", 9) - .testStatement("8 and 9", 9) - .testStatement("0 and 9", 0) - - .testStatement("1 and 2 or 3", 2) - .testStatement("0 and 2 or 3", 3) - .testStatement("1 and 0 or 3", 3) - - .testStatement("1 or 2 and 3", 1) - .testStatement("0 or 2 and 3", 3) - .testStatement("0 or 0 and 3", 0) - .testStatement("1 or 0 and 3", 1) - - .testStatement("None and 1", Runtime.NONE) - .testStatement("\"\" or 9", 9) - .testStatement("\"abc\" or 9", "abc") - - // check that 'foo' is not evaluated - .testStatement("8 or foo", 8) - .testStatement("0 and foo", 0); - - new SkylarkTest() - .testIfErrorContains("name 'google' is not defined", "0 and google") - .testIfErrorContains("name 'google' is not defined", "8 or google"); - } - - @Test - public void testNot() throws Exception { - newTest().testStatement("not 1", false).testStatement("not ''", true); - } - - @Test - public void testNotWithLogicOperators() throws Exception { - newTest() - .testStatement("not (0 and 0)", true) - .testStatement("not (1 or 0)", false) - - .testStatement("0 and not 0", 0) - .testStatement("not 0 and 0", 0) - - .testStatement("1 and not 0", true) - .testStatement("not 0 or 0", true) - - .testStatement("not 1 or 0", 0) - .testStatement("not 1 or 1", 1); - } - - @Test - public void testNotWithArithmeticOperators() throws Exception { - newTest().testStatement("not 0 + 0", true).testStatement("not 2 - 1", false); - } - - @Test - public void testNotWithCollections() throws Exception { - newTest().testStatement("not []", true).testStatement("not {'a' : 1}", false); - } - - @Test - public void testEquality() throws Exception { - newTest() - .testStatement("1 == 1", true) - .testStatement("1 == 2", false) - .testStatement("'hello' == 'hel' + 'lo'", true) - .testStatement("'hello' == 'bye'", false) - .testStatement("None == None", true) - .testStatement("[1, 2] == [1, 2]", true) - .testStatement("[1, 2] == [2, 1]", false) - .testStatement("{'a': 1, 'b': 2} == {'b': 2, 'a': 1}", true) - .testStatement("{'a': 1, 'b': 2} == {'a': 1}", false) - .testStatement("{'a': 1, 'b': 2} == {'a': 1, 'b': 2, 'c': 3}", false) - .testStatement("{'a': 1, 'b': 2} == {'a': 1, 'b': 3}", false); - } - - @Test - public void testInequality() throws Exception { - newTest() - .testStatement("1 != 1", false) - .testStatement("1 != 2", true) - .testStatement("'hello' != 'hel' + 'lo'", false) - .testStatement("'hello' != 'bye'", true) - .testStatement("[1, 2] != [1, 2]", false) - .testStatement("[1, 2] != [2, 1]", true) - .testStatement("{'a': 1, 'b': 2} != {'b': 2, 'a': 1}", false) - .testStatement("{'a': 1, 'b': 2} != {'a': 1}", true) - .testStatement("{'a': 1, 'b': 2} != {'a': 1, 'b': 2, 'c': 3}", true) - .testStatement("{'a': 1, 'b': 2} != {'a': 1, 'b': 3}", true); - } - - @Test - public void testEqualityPrecedence() throws Exception { - newTest() - .testStatement("1 + 3 == 2 + 2", true) - .testStatement("not 1 == 2", true) - .testStatement("not 1 != 2", false) - .testStatement("2 and 3 == 3 or 1", true) - .testStatement("2 or 3 == 3 and 1", 2); - } - - @Test - public void testLessThan() throws Exception { - newTest() - .testStatement("1 <= 1", true) - .testStatement("1 < 1", false) - .testStatement("'a' <= 'b'", true) - .testStatement("'c' < 'a'", false); - } - - @Test - public void testGreaterThan() throws Exception { - newTest() - .testStatement("1 >= 1", true) - .testStatement("1 > 1", false) - .testStatement("'a' >= 'b'", false) - .testStatement("'c' > 'a'", true); - } - - @Test public void testConditionalExpressions() throws Exception { newTest() .testStatement("1 if True else 2", 1) |