Bug 1353074 - Use tuples for script arguments; r=maja_zf
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:14:16 +0100
changeset 402885 2e1d7f5759caf23d66b335e6a46206451f220fa4
parent 402884 fa0c99211baaaa10f530cdfed37234f2851b0c54
child 402886 216ae291fec3a1886563dee5b418588d7c83b82e
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf
bugs1353074
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1353074 - Use tuples for script arguments; r=maja_zf The Python standard library uses tuples to define arguments for functions, whenever they are invoked through meta programming. The Marionette client only allows the list type for backwards compatibility, so we prefer tuples in this case. Another good argument for tuples is that tuples are immutable. MozReview-Commit-ID: 72zPzYvBz7Q
testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
@@ -91,34 +91,34 @@ class TestExecuteContent(MarionetteTestC
     def test_no_return_value(self):
         self.assertIsNone(self.marionette.execute_script("true"))
 
     def test_argument_null(self):
         self.assertIsNone(self.marionette.execute_script("return arguments[0]", [None]))
 
     def test_argument_number(self):
         self.assertEqual(
-            1, self.marionette.execute_script("return arguments[0]", [1]))
+            1, self.marionette.execute_script("return arguments[0]", (1,)))
         self.assertEqual(
-            1.5, self.marionette.execute_script("return arguments[0]", [1.5]))
+            1.5, self.marionette.execute_script("return arguments[0]", (1.5,)))
 
     def test_argument_boolean(self):
-        self.assertTrue(self.marionette.execute_script("return arguments[0]", [True]))
+        self.assertTrue(self.marionette.execute_script("return arguments[0]", (True,)))
 
     def test_argument_string(self):
         self.assertEqual(
-            "foo", self.marionette.execute_script("return arguments[0]", ["foo"]))
+            "foo", self.marionette.execute_script("return arguments[0]", ("foo",)))
 
     def test_argument_array(self):
         self.assertEqual(
-            [1, 2], self.marionette.execute_script("return arguments[0]", [[1, 2]]))
+            [1, 2], self.marionette.execute_script("return arguments[0]", ([1, 2],)))
 
     def test_argument_object(self):
         self.assertEqual({"foo": 1}, self.marionette.execute_script(
-            "return arguments[0]", [{"foo": 1}]))
+            "return arguments[0]", ({"foo": 1},)))
 
     def test_globals(self):
         for property in globals:
             self.assert_is_defined(property)
         self.assert_is_defined("Components")
         self.assert_is_defined("window.wrappedJSObject")
 
     def test_system_globals(self):