diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-01-23 14:35:14 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-01-23 14:35:14 +0800 |
| commit | 7ac3519dc40bb6f6ab979c9cd35fd585f25d1c25 (patch) | |
| tree | 024fabcf12638dbd4cb9fe6c58251f9227fc9380 /spec | |
| parent | 782334d95720819f216004e0120ea84ba2c43afb (diff) | |
| download | yuescript-7ac3519dc40bb6f6ab979c9cd35fd585f25d1c25.tar.gz yuescript-7ac3519dc40bb6f6ab979c9cd35fd585f25d1c25.tar.bz2 yuescript-7ac3519dc40bb6f6ab979c9cd35fd585f25d1c25.zip | |
fix Moonscript issue 156, update new 'import' functions.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/inputs/comprehension.moon | 2 | ||||
| -rw-r--r-- | spec/inputs/destructure.moon | 7 | ||||
| -rw-r--r-- | spec/inputs/existential.moon | 16 | ||||
| -rw-r--r-- | spec/inputs/import.moon | 19 |
4 files changed, 40 insertions, 4 deletions
diff --git a/spec/inputs/comprehension.moon b/spec/inputs/comprehension.moon index f07cf89..b6adb94 100644 --- a/spec/inputs/comprehension.moon +++ b/spec/inputs/comprehension.moon | |||
| @@ -47,6 +47,6 @@ ok(a,b,c) for {a,b,c} in things | |||
| 47 | _ = [item for item in *items[1 + 2,3+4]] | 47 | _ = [item for item in *items[1 + 2,3+4]] |
| 48 | _ = [item for item in *items[hello! * 4, 2 - thing[4]]] | 48 | _ = [item for item in *items[hello! * 4, 2 - thing[4]]] |
| 49 | 49 | ||
| 50 | 50 | list = [item?\invoke 123 for item in items] | |
| 51 | 51 | ||
| 52 | nil | 52 | nil |
diff --git a/spec/inputs/destructure.moon b/spec/inputs/destructure.moon index 2509968..5bc7810 100644 --- a/spec/inputs/destructure.moon +++ b/spec/inputs/destructure.moon | |||
| @@ -95,6 +95,11 @@ _ = (z) -> | |||
| 95 | 95 | ||
| 96 | do | 96 | do |
| 97 | z = "oo" | 97 | z = "oo" |
| 98 | (k) -> | 98 | _ = (k) -> |
| 99 | {a,b,c} = z | 99 | {a,b,c} = z |
| 100 | 100 | ||
| 101 | do | ||
| 102 | {function:{end:endVar}} = thing | ||
| 103 | |||
| 104 | do | ||
| 105 | {if:{a,b,c}} = thing | ||
diff --git a/spec/inputs/existential.moon b/spec/inputs/existential.moon index 97e8de0..eaa3266 100644 --- a/spec/inputs/existential.moon +++ b/spec/inputs/existential.moon | |||
| @@ -1,8 +1,20 @@ | |||
| 1 | if {:x} = a?.if?\then?(123)? @?\function 998 | 1 | |
| 2 | f?! | ||
| 3 | |||
| 4 | x = tab?.value | ||
| 5 | |||
| 6 | print abc?["hello world"]?.xyz | ||
| 7 | |||
| 8 | if print and x? | ||
| 2 | print x | 9 | print x |
| 3 | 10 | ||
| 11 | @?\func 998 | ||
| 12 | |||
| 4 | with abc?!\func?! | 13 | with abc?!\func?! |
| 5 | if \p? "abc" | 14 | if \p? "abc" |
| 6 | return 123 | 15 | return 123 |
| 7 | 16 | ||
| 8 | @?\func 998 | 17 | if {:x} = a?.if?\then?(123)? @?\function 998 |
| 18 | print x | ||
| 19 | |||
| 20 | |||
diff --git a/spec/inputs/import.moon b/spec/inputs/import.moon index d86d724..ef6f4ee 100644 --- a/spec/inputs/import.moon +++ b/spec/inputs/import.moon | |||
| @@ -46,3 +46,22 @@ do | |||
| 46 | c | 46 | c |
| 47 | from z | 47 | from z |
| 48 | 48 | ||
| 49 | |||
| 50 | do | ||
| 51 | import 'module' | ||
| 52 | import 'module_x' | ||
| 53 | import "d-a-s-h-e-s" | ||
| 54 | import "module.part" | ||
| 55 | |||
| 56 | do | ||
| 57 | import "player" as Player | ||
| 58 | import "lpeg" as {:C, :Ct, :Cmt} | ||
| 59 | |||
| 60 | do | ||
| 61 | export * | ||
| 62 | import 'module' | ||
| 63 | import 'module_x' | ||
| 64 | import "org.package.module-y" | ||
| 65 | |||
| 66 | do | ||
| 67 | import "org.package.module" as {function:func,if:ifVar} | ||
