def test_serialize_call_with_one_arg(): assert_equal("f(x)", _dumps(js.call(js.ref("f"), [js.ref("x")])))
def test_serialize_call_with_multiple_args(): assert_equal("f(x, y)", _dumps(js.call(js.ref("f"), [js.ref("x"), js.ref("y")])))
def closing_brace_of_function_expression_is_on_same_line_as_closing_paren_of_call(self): node = js.call( js.ref("f"), [js.function_expression([], [js.ret(js.ref("x"))])] ) assert_equal("f(function() {\n return x;\n})", self._dumps(node))
def test_serialize_call_with_no_args(): assert_equal("f()", _dumps(js.call(js.ref("f"), [])))
def test_transform_reference_to_module_in_same_package(): _assert_transform( cc.module_ref([".", "x"]), js.call(js.ref("$require"), [js.string("./x")]), )
def test_transform_reference_to_parent_package(): _assert_transform( cc.module_ref([".."]), js.call(js.ref("$require"), [js.string("../")]), )
def test_transform_attribute_access(): _assert_transform( cc.attr(cc.ref("x"), "y"), js.call(js.ref("$nope.builtins.getattr"), [js.ref("x"), js.string("y")]) )
def test_transform_call_with_positional_arguments(): _assert_transform( cc.call(cc.ref("f"), [cc.ref("x"), cc.ref("y")]), js.call(js.ref("f"), [js.ref("x"), js.ref("y")]), )
def test_transform_reference_to_top_level_module(): _assert_transform( cc.module_ref("x"), js.call(js.ref("$require"), [js.string("x")]), )