Exemplo n.º 1
0
def test_transform_module_with_exports():
    _assert_transform(
        cc.module([
            cc.declare("__all__"),
            cc.declare("x"),
            cc.assign(cc.ref("__all__"), cc.list_literal([cc.str_literal("x")])),
            cc.assign(cc.ref("x"), cc.none)
        ], exported_names=["x"]),
        """
            var __all__;
            var x;
            __all__ = ["x"];
            x = null;
            $exports.x = x;
        """
    )
Exemplo n.º 2
0
def test_transform_string_expression():
    _assert_transform(
        cc.str_literal("hello"),
        js.string("hello")
    )
Exemplo n.º 3
0
 def test_transform(self):
     _assert_transform(
         nodes.str_literal("Many places I have been"),
         cc.str_literal("Many places I have been")
     )