-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
collects imports, removes bang line, and prepends at top of script (#75)
* collects imports, removes bang line, and prepends at top of script * install maven with apt-get rather than sdkman * remove unneccessary code that does nothing * add failing unit test for import without trailing space * change file names so ide does not have falase positive squiqqlies * made test pass for import with trailing space only * changed way of checking null, switched if else around as per review * added back specific null test, as "i do not exist.kts" test fails * revert travis.yml change so sdkman now installs maven again (I hope)
- Loading branch information
1 parent
7fc29bb
commit f759ec4
Showing
8 changed files
with
155 additions
and
15 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import io.kotlintest.matchers.shouldBe | ||
import kscript.app.* | ||
import org.junit.Test | ||
import java.io.File | ||
import org.hamcrest.core.Is.* | ||
import org.junit.Assert.* | ||
|
||
class ConsolidateImports { | ||
|
||
@Test | ||
fun test_consolidate_imports() { | ||
val classLoader = javaClass.classLoader | ||
val file = this.javaClass.getResource("/consolidate_includes/input.script").file | ||
val expected = this.javaClass.getResource("/consolidate_includes/expected.script") | ||
val result = resolveIncludes(File(file)) | ||
|
||
assertThat(result.readText(),`is`(expected.readText())) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import here.we.go | ||
import we.go.here | ||
import go.here.we | ||
import if.not.now.when | ||
import if.not.me.then.who | ||
import my.cool.class | ||
//DEPS com.eclipsesource.minimal-json:minimal-json:0.9.4 | ||
|
||
file 1 | ||
|
||
Lastly, she pictured to herself how this same little sister of | ||
hers would, in the after-time, be herself a grown woman; and how | ||
she would keep, through all her riper years, the simple and | ||
loving heart of her childhood: and how she would gather about | ||
her other little children, and make THEIR eyes bright and eager | ||
with many a strange tale, perhaps even with the dream of | ||
Wonderland of long ago: and how she would feel with all their | ||
simple sorrows, and find a pleasure in all their simple joys, | ||
remembering her own child-life, and the happy summer days. | ||
|
||
|
||
file 2 | ||
|
||
Alice waited a little, half expecting to see it again, but it | ||
did not appear, and after a minute or two she walked on in the | ||
direction in which the March Hare was said to live. `I've seen | ||
hatters before,' she said to herself; `the March Hare will be | ||
much the most interesting, and perhaps as this is May it won't be | ||
raving mad--at least not so mad as it was in March.' As she said | ||
this, she looked up, and there was the Cat again, sitting on a | ||
branch of a tree. | ||
|
||
file 3 | ||
important to not treat me as import | ||
|
||
This time Alice waited patiently until it chose to speak again. | ||
In a minute or two the Caterpillar took the hookah out of its | ||
mouth and yawned once or twice, and shook itself. Then it got | ||
down off the mushroom, and crawled away in the grass, merely | ||
remarking as it went, `One side will make you grow taller, and | ||
the other side will make you grow shorter.' | ||
|
||
|
||
Script | ||
important to also not treat me as import | ||
|
||
Alice was beginning to get very tired of sitting by her sister | ||
on the bank, and of having nothing to do: once or twice she had | ||
peeped into the book her sister was reading, but it had no | ||
pictures or conversations in it, `and what is the use of a book,' | ||
thought Alice `without pictures or conversation?' | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import here.we.go | ||
import we.go.here | ||
import go.here.we | ||
|
||
file 1 | ||
|
||
Lastly, she pictured to herself how this same little sister of | ||
hers would, in the after-time, be herself a grown woman; and how | ||
she would keep, through all her riper years, the simple and | ||
loving heart of her childhood: and how she would gather about | ||
her other little children, and make THEIR eyes bright and eager | ||
with many a strange tale, perhaps even with the dream of | ||
Wonderland of long ago: and how she would feel with all their | ||
simple sorrows, and find a pleasure in all their simple joys, | ||
remembering her own child-life, and the happy summer days. |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import here.we.go | ||
import we.go.here | ||
import if.not.now.when | ||
|
||
file 2 | ||
|
||
Alice waited a little, half expecting to see it again, but it | ||
did not appear, and after a minute or two she walked on in the | ||
direction in which the March Hare was said to live. `I've seen | ||
hatters before,' she said to herself; `the March Hare will be | ||
much the most interesting, and perhaps as this is May it won't be | ||
raving mad--at least not so mad as it was in March.' As she said | ||
this, she looked up, and there was the Cat again, sitting on a | ||
branch of a tree. |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import go.here.we | ||
import if.not.me.then.who | ||
|
||
file 3 | ||
important to not treat me as import | ||
|
||
This time Alice waited patiently until it chose to speak again. | ||
In a minute or two the Caterpillar took the hookah out of its | ||
mouth and yawned once or twice, and shook itself. Then it got | ||
down off the mushroom, and crawled away in the grass, merely | ||
remarking as it went, `One side will make you grow taller, and | ||
the other side will make you grow shorter.' |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env kscript | ||
//DEPS com.eclipsesource.minimal-json:minimal-json:0.9.4 | ||
//INCLUDE file1 | ||
//INCLUDE file2 | ||
//INCLUDE file3 | ||
|
||
import my.cool.class | ||
|
||
Script | ||
important to also not treat me as import | ||
|
||
Alice was beginning to get very tired of sitting by her sister | ||
on the bank, and of having nothing to do: once or twice she had | ||
peeped into the book her sister was reading, but it had no | ||
pictures or conversations in it, `and what is the use of a book,' | ||
thought Alice `without pictures or conversation?' |