Add list.pop

--
MOS_MIGRATED_REVID=110778743
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 acc3923..8d90454 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
@@ -1113,9 +1113,11 @@
 
   @Test
   public void testListAccessBadIndex() throws Exception {
-    new BothModesTest().testIfErrorContains(
-        "expected value of type 'int' for index operand, but got \"a\" (string)",
-        "[[1], [2]]['a']");
+    new BothModesTest()
+        .testIfErrorContains(
+            "Method list.$index(key: int) is not applicable for arguments (string): "
+                + "'key' is string, but should be int",
+            "[[1], [2]]['a']");
   }
 
   @Test
@@ -1485,6 +1487,30 @@
   }
 
   @Test
+  public void testListPop() throws Exception {
+    new BothModesTest()
+        .setUp("li = [2, 3, 4]; ret = li.pop()")
+        .testLookup("li", MutableList.of(env, 2, 3))
+        .testLookup("ret", 4);
+    new BothModesTest()
+        .setUp("li = [2, 3, 4]; ret = li.pop(-2)")
+        .testLookup("li", MutableList.of(env, 2, 4))
+        .testLookup("ret", 3);
+    new BothModesTest()
+        .setUp("li = [2, 3, 4]; ret = li.pop(1)")
+        .testLookup("li", MutableList.of(env, 2, 4))
+        .testLookup("ret", 3);
+    new BothModesTest()
+        .testIfErrorContains(
+            "List index out of range (index is 3, but list has 2 elements)", "[1, 2].pop(3)");
+
+    new BuildTest()
+        .testIfErrorContains(
+            "function pop is not defined on object of type 'tuple'", "(1, 2).pop()");
+    new SkylarkTest().testIfErrorContains("Type tuple has no function pop()", "(1, 2).pop()");
+  }
+
+  @Test
   public void testReassignmentOfPrimitivesNotForbiddenByCoreLanguage() throws Exception {
     new BuildTest()
         .setUp("cc_binary = (['hello.cc'])")