зеркало из https://github.com/mozilla/gecko-dev.git
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 --HG-- extra : rebase_source : 79315dd809e00c4c805bd0de3244b519e3ff286f
This commit is contained in:
Родитель
42acd45542
Коммит
cb1c619b93
|
@ -96,24 +96,24 @@ class TestExecuteContent(MarionetteTestCase):
|
|||
|
||||
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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче