summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorJános Veres <janos.veres@gmail.com>2020-12-02 20:26:04 +0100
committerGitHub <noreply@github.com>2020-12-02 20:26:04 +0100
commit93d9f51d16711e6ec0763e1189eb1a57a5ba8e3e (patch)
tree3bc8324a7122567de62c2f291a5996436cb21eeb /cli/tests
parent95ccc1a52f891841cfdfbb87229cef17139be399 (diff)
fix(cli): add hygiene pass to transpile pipeline (#8586)
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs5
-rw-r--r--cli/tests/runtime_decorators.ts42
-rw-r--r--cli/tests/runtime_decorators.ts.out7
3 files changed, 54 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index c99033020..aca2df99c 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -2927,6 +2927,11 @@ itest!(no_check_decorators {
output: "no_check_decorators.ts.out",
});
+itest!(runtime_decorators {
+ args: "run --quiet --reload --no-check runtime_decorators.ts",
+ output: "runtime_decorators.ts.out",
+});
+
itest!(lib_ref {
args: "run --quiet --unstable --reload lib_ref.ts",
output: "lib_ref.ts.out",
diff --git a/cli/tests/runtime_decorators.ts b/cli/tests/runtime_decorators.ts
new file mode 100644
index 000000000..5da109110
--- /dev/null
+++ b/cli/tests/runtime_decorators.ts
@@ -0,0 +1,42 @@
+// deno-lint-ignore-file
+function A() {
+ console.log("@A evaluated");
+ return function (
+ target: any,
+ propertyKey: string,
+ descriptor: PropertyDescriptor,
+ ) {
+ console.log("@A called");
+ const fn = descriptor.value;
+ descriptor.value = function () {
+ console.log("fn() called from @A");
+ fn();
+ };
+ };
+}
+
+function B() {
+ console.log("@B evaluated");
+ return function (
+ target: any,
+ propertyKey: string,
+ descriptor: PropertyDescriptor,
+ ) {
+ console.log("@B called");
+ const fn = descriptor.value;
+ descriptor.value = function () {
+ console.log("fn() called from @B");
+ fn();
+ };
+ };
+}
+
+class C {
+ @A()
+ @B()
+ static test() {
+ console.log("C.test() called");
+ }
+}
+
+C.test();
diff --git a/cli/tests/runtime_decorators.ts.out b/cli/tests/runtime_decorators.ts.out
new file mode 100644
index 000000000..0fc1d4590
--- /dev/null
+++ b/cli/tests/runtime_decorators.ts.out
@@ -0,0 +1,7 @@
+@A evaluated
+@B evaluated
+@B called
+@A called
+fn() called from @A
+fn() called from @B
+C.test() called