From bf128d295f7677a993a1a35416accd872705fe59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 13 Feb 2019 11:33:28 +0900 Subject: [PATCH] Add test for #182. Closes #182. --- ecmascript/transforms/src/helpers/mod.rs | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/ecmascript/transforms/src/helpers/mod.rs b/ecmascript/transforms/src/helpers/mod.rs index 4c7c878bedc..9d9725af284 100644 --- a/ecmascript/transforms/src/helpers/mod.rs +++ b/ecmascript/transforms/src/helpers/mod.rs @@ -242,8 +242,9 @@ mod tests { cm: tester.cm.clone(), } }, - "", - "function _throw(e) { + "'use strict'", + "'use strict' +function _throw(e) { throw e; } ", @@ -251,6 +252,25 @@ mod tests { ) } + #[test] + fn name_conflict() { + ::tests::test_transform( + Default::default(), + |tester| { + helper!(throw); + InjectHelpers { + cm: tester.cm.clone(), + } + }, + "let _throw = null", + "function _throw(e) { + throw e; +} +let _throw1 = null; +", + false, + ) + } #[test] fn use_strict_abort() { ::tests::test_transform(