Skip to content

Commit 39a5124

Browse files
committed
Add test for #761
1 parent c8e59a3 commit 39a5124

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

test/unit/hoisting.spec.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,20 @@ test("Hoisting due to reference from hoisted function", () => {
110110
});
111111

112112
test("Namespace Hoisting", () => {
113-
const code = `
114-
function bar() {
115-
return NS.foo;
116-
}
117-
namespace NS {
118-
export let foo = "foo";
113+
util.testModule`
114+
const Inner = 0;
115+
namespace Outer {
116+
export function bar() {
117+
return Inner.foo;
118+
}
119+
namespace Inner {
120+
export const foo = "foo";
121+
}
119122
}
120-
export const foo = bar();
121-
`;
122-
const result = util.transpileExecuteAndReturnExport(code, "foo");
123-
expect(result).toBe("foo");
123+
124+
export const foo = Outer.bar();
125+
export { Inner };
126+
`.expectToMatchJsResult();
124127
});
125128

126129
test("Exported Namespace Hoisting", () => {

0 commit comments

Comments
 (0)