diff options
author | 2015-12-16 15:02:03 +0000 | |
---|---|---|
committer | 2015-12-16 15:31:41 +0000 | |
commit | 8853df9a19dabc72c3b723b84e6cb69b6fb2884e (patch) | |
tree | 4b7b7efb3b8092333c0a96eadbce6da65979f195 /src/test/java/com/google | |
parent | f8f855c6ee75a30558a3ce3dcb0759a1dcc59504 (diff) |
Implement list.remove function
--
MOS_MIGRATED_REVID=110356439
Diffstat (limited to 'src/test/java/com/google')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java index f649ce2ab1..772d875850 100644 --- a/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java +++ b/src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java @@ -1306,6 +1306,27 @@ public class MethodLibraryTest extends EvaluationTestCase { } @Test + public void testListRemove() throws Exception { + new BothModesTest() + .setUp("foo = ['a', 'b', 'c', 'b']", "foo.remove('b')") + .testLookup("foo", MutableList.of(env, "a", "c", "b")) + .setUp("foo.remove('c')") + .testLookup("foo", MutableList.of(env, "a", "b")) + .setUp("foo.remove('a')") + .testLookup("foo", MutableList.of(env, "b")) + .setUp("foo.remove('b')") + .testLookup("foo", MutableList.of(env)) + .testIfErrorContains("Item 3 not found in list", "[1, 2].remove(3)"); + + new BuildTest() + .testIfErrorContains( + "function remove is not defined on object of type 'tuple'", "(1, 2).remove(3)"); + + new SkylarkTest() + .testIfErrorContains("Type tuple has no function remove(int)", "(1, 2).remove(3)"); + } + + @Test public void testReassignmentOfPrimitivesNotForbiddenByCoreLanguage() throws Exception { new BuildTest() .setUp("cc_binary = (['hello.cc'])") |