-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from fink-lang/cleanup
cleanup
- Loading branch information
Showing
62 changed files
with
833 additions
and
670 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
{generate} = import '.' | ||
{fink2js} = import './testing' | ||
{describe, it, to_throw} = import './testing/jest' | ||
{describe, it, expect, to_throw} = import './testing/jest' | ||
|
||
|
||
describe:: 'errors', fn: | ||
it:: 'throws with code snippet', fn: | ||
( | ||
fn: fink2js(` | ||
123 = foo` | ||
) | ||
) to_throw ` | ||
test.fnk:1:0 | ||
1| 123 = foo | ||
^ | ||
|
||
Unable to transform 'assign ='.` | ||
|
||
( | ||
fn: generate({ | ||
type: 'test', | ||
op: null, | ||
loc: { | ||
start: {pos: 0, line: 1, column: 0}, | ||
end: {pos: 9, line: 1, column: 9} | ||
} | ||
}, 'test.fnk', 'foobar') | ||
|
||
) to_throw ` | ||
test.fnk:1:0 | ||
1| foobar | ||
^ | ||
|
||
Unable to transform 'test'. | ||
|
||
Unknown expression` | ||
expect:: | ||
fn: fink2js` | ||
123 = foo` | ||
|
||
to_throw:: ` | ||
test.fnk:1:0 | ||
1| 123 = foo | ||
^ | ||
|
||
Unable to transform 'assign ='.` | ||
|
||
expect:: | ||
fn: generate({ | ||
type: 'test', | ||
op: null, | ||
loc: { | ||
start: {pos: 0, line: 1, column: 0}, | ||
end: {pos: 9, line: 1, column: 9} | ||
} | ||
}, 'test.fnk', 'foobar') | ||
|
||
to_throw:: ` | ||
test.fnk:1:0 | ||
1| foobar | ||
^ | ||
|
||
Unable to transform 'test'. | ||
|
||
Unknown expression` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,42 @@ | ||
{fink2js} = import '../../testing' | ||
{describe, it, eq, snapshot} = import '../../testing/jest' | ||
{describe, it, expect, to_match_snapshot} = import '../../testing/jest' | ||
|
||
|
||
describe:: 'assignment', fn: | ||
it:: 'compiles', fn: | ||
fink2js(` | ||
assign = 1 | ||
# simple | ||
assign2 = assign | ||
expect:: | ||
fink2js` | ||
assign = 1 | ||
# simple | ||
assign2 = assign | ||
|
||
no_clash_with_await = 13 | ||
no_clash_with_await = 13 | ||
|
||
assign_lang_const1 = true | ||
assign_lang_const2 = false | ||
assign_lang_const1 = true | ||
assign_lang_const2 = false | ||
|
||
multi_line_assign = 123 | ||
+ 234 + | ||
-567 | ||
- 1111 | ||
`) eq snapshot | ||
multi_line_assign = 123 | ||
+ 234 + | ||
-567 | ||
- 1111 | ||
` | ||
to_match_snapshot | ||
|
||
|
||
it:: 'compiles destructuring', fn: | ||
fink2js(` | ||
# standard JS destructuring | ||
[...head, last] = '1234' | ||
`) eq snapshot | ||
|
||
|
||
fink2js(` | ||
# enhanced destructuring | ||
[foo, bar, ...spam, ni, shrub] = '123' | ||
|
||
[a, , ..., b, c] = '123' | ||
`) eq snapshot | ||
expect:: | ||
fink2js` | ||
# standard JS destructuring | ||
[...head, last] = '1234' | ||
` | ||
to_match_snapshot | ||
|
||
|
||
expect:: | ||
fink2js` | ||
# enhanced destructuring | ||
[foo, bar, ...spam, ni, shrub] = '123' | ||
|
||
[a, , ..., b, c] = '123' | ||
` | ||
to_match_snapshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
{fink2js} = import '../../testing' | ||
{describe, it, eq, snapshot} = import '../../testing/jest' | ||
{describe, it, expect, to_match_snapshot} = import '../../testing/jest' | ||
|
||
|
||
describe:: 'await', fn: | ||
it:: 'compiles', fn: | ||
|
||
fink2js(` | ||
task1 = fn foo: - await foo | ||
expect:: | ||
fink2js` | ||
task1 = fn foo: - await foo | ||
|
||
task2 = fn foo: await (foo + 4) | ||
task2 = fn foo: await (foo + 4) | ||
|
||
task3 = fn foo: | ||
bar = await foo() | ||
bar + 123 | ||
task3 = fn foo: | ||
bar = await foo() | ||
bar + 123 | ||
|
||
a_gen = unfold curr=0: | ||
match shrub: | ||
spam: await ni(curr) | ||
else : curr + 1 | ||
a_gen = unfold curr=0: | ||
match shrub: | ||
spam: await ni(curr) | ||
else : curr + 1 | ||
|
||
await ni | ||
`) eq snapshot | ||
await ni | ||
` | ||
to_match_snapshot | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
{fink2js} = import '../../testing' | ||
{describe, it, eq, snapshot} = import '../../testing/jest' | ||
{describe, it, expect, to_match_snapshot} = import '../../testing/jest' | ||
|
||
|
||
describe:: 'call', fn: | ||
it:: 'compiles', fn: | ||
|
||
fink2js(` | ||
call1 = a(ni, x=123, ...x) | ||
call2 = a(ni) | ||
call3 = a () | ||
call4 = a(fn x: x*2) | ||
`) eq snapshot | ||
expect:: | ||
fink2js` | ||
call1 = a(ni, x=123, ...x) | ||
call2 = a(ni) | ||
call3 = a () | ||
call4 = a(fn x: x*2) | ||
` | ||
to_match_snapshot | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
{fink2js} = import '../../testing' | ||
{describe, it, eq, snapshot} = import '../../testing/jest' | ||
{describe, it, expect, to_match_snapshot} = import '../../testing/jest' | ||
|
||
|
||
describe:: 'pipe', fn: | ||
it:: 'compiles', fn: | ||
|
||
fink2js(` | ||
pipe: | ||
foo | ||
bar | ||
spam | ||
expect:: | ||
fink2js` | ||
pipe: | ||
foo | ||
bar | ||
spam | ||
|
||
pipe [1, 2, 3]: | ||
map item: item * 2 | ||
`) eq snapshot | ||
pipe [1, 2, 3]: | ||
map item: item * 2 | ||
` | ||
to_match_snapshot | ||
|
Oops, something went wrong.