diff options
author | 2016-04-07 08:02:00 +0000 | |
---|---|---|
committer | 2016-04-07 11:50:49 +0000 | |
commit | 6c2276a7dd10447128d9ae92d25fdc45579e63fb (patch) | |
tree | 2d4d6773f9d3109faf4fc0e8e510e795b92c2c2c /src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java | |
parent | 417dad0f1e0d0ed4ccd5f8e52b49eb79937da49d (diff) |
implement list.insert for skylark rule
RELNOTES: implement list.insert for skylark rule
--
MOS_MIGRATED_REVID=119243427
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java | 16 |
1 files changed, 16 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 ec2d00f8d9..9f1285cdd0 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 @@ -1531,6 +1531,22 @@ public class MethodLibraryTest extends EvaluationTestCase { @Test public void testPyListAppend() throws Exception { new BuildTest() + .setUp("FOO = ['a', 'b']", "FOO.insert(0, 'c')") + .testLookup("FOO", MutableList.of(env, "c", "a", "b")) + .setUp("FOO.insert(1, 'd')") + .testLookup("FOO", MutableList.of(env, "c", "d", "a", "b")) + .setUp("FOO.insert(4, 'e')") + .testLookup("FOO", MutableList.of(env, "c", "d", "a", "b", "e")) + .setUp("FOO.insert(-10, 'f')") + .testLookup("FOO", MutableList.of(env, "f", "c", "d", "a", "b", "e")) + .setUp("FOO.insert(10, 'g')") + .testLookup("FOO", MutableList.of(env, "f", "c", "d", "a", "b", "e", "g")) + .testIfErrorContains("Type tuple has no function insert(int)", "(1, 2).insert(3)"); + } + + @Test + public void testPyListInsert() throws Exception { + new BuildTest() .setUp("FOO = ['a', 'b']", "FOO.append('c')") .testLookup("FOO", MutableList.of(env, "a", "b", "c")) .testIfErrorContains("Type tuple has no function append(int)", "(1, 2).append(3)"); |