aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Laurent Le Brun <laurentlb@google.com>2016-03-07 17:14:10 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-03-08 03:44:33 +0000
commitb525beeb7db758b6b73aec0153b2ec8c4a028a17 (patch)
tree87db3f355691e6c68f6e1a4b71b96ed6cb0f9acc /src/test/java/com/google/devtools/build
parent8056c4577614f3d6374a01b8b3014a2070e1fe41 (diff)
Skylark: implement dict.update
-- MOS_MIGRATED_REVID=116553978
Diffstat (limited to 'src/test/java/com/google/devtools/build')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/MethodLibraryTest.java19
1 files changed, 15 insertions, 4 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 1935a7eacb..55b0de2e1a 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
@@ -443,10 +443,11 @@ public class MethodLibraryTest extends EvaluationTestCase {
@Test
public void testDir() throws Exception {
- new SkylarkTest().testStatement(
- "str(dir({}))",
- "[\"$index\", \"clear\", \"get\", \"items\", \"keys\","
- + " \"pop\", \"popitem\", \"setdefault\", \"values\"]");
+ new SkylarkTest()
+ .testStatement(
+ "str(dir({}))",
+ "[\"$index\", \"clear\", \"get\", \"items\", \"keys\","
+ + " \"pop\", \"popitem\", \"setdefault\", \"update\", \"values\"]");
}
@Test
@@ -1360,6 +1361,16 @@ public class MethodLibraryTest extends EvaluationTestCase {
}
@Test
+ public void testDictionaryUpdate() throws Exception {
+ new BothModesTest()
+ .setUp("foo = {'a': 2}")
+ .testEval("foo.update({'b': 4}); foo", "{'a': 2, 'b': 4}");
+ new BothModesTest()
+ .setUp("foo = {'a': 2}")
+ .testEval("foo.update({'a': 3, 'b': 4}); foo", "{'a': 3, 'b': 4}");
+ }
+
+ @Test
public void testDictionarySetDefault() throws Exception {
new SkylarkTest()
.testEval(