-
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.
- Loading branch information
colin-passiv
committed
Sep 12, 2016
1 parent
a88d8ff
commit 30f71f8
Showing
6 changed files
with
39 additions
and
2 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
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,29 @@ | ||
import com.passivsystems.embed.Embed._ | ||
|
||
import org.scalatest._ | ||
|
||
class EmbedTest extends FlatSpec with Matchers { | ||
|
||
private def contentOf(path: String) = { | ||
val source = scala.io.Source.fromFile(path) | ||
val content = source.mkString | ||
source.close() | ||
content | ||
} | ||
|
||
"Embed" should "include static file content" in { | ||
val txt = embed("resource.txt") | ||
val expectedTxt = contentOf("src/test/scala/resource.txt") | ||
txt should be (expectedTxt) | ||
} | ||
|
||
it should "string interpolate static file content" in { | ||
def test(guard: Boolean) = { | ||
val txt = sEmbed("sResource.txt") | ||
val expectedTxt = s"the guard is: ${if (guard) "TRUE" else "FALSE"}\n" | ||
txt should be (expectedTxt) | ||
} | ||
test(true) | ||
test(false) | ||
} | ||
} |
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,3 @@ | ||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce congue neque quam, in dignissim mi porttitor ut. Nunc pulvinar leo id commodo lobortis. Nunc magna felis, suscipit sed bibendum et, sodales iaculis nunc. Nunc eros velit, suscipit quis leo vitae, facilisis ultrices velit. Curabitur ultrices aliquam metus, id sagittis est semper id. Maecenas quam ex, lobortis at aliquet eget, lobortis eget est. Cras efficitur dolor vitae arcu aliquet, vel bibendum sem sollicitudin. Maecenas et tempus leo, eget aliquam quam. Aenean semper sollicitudin vestibulum. | ||
|
||
Aliquam sed ex malesuada urna molestie pellentesque. In vel magna consectetur, efficitur massa id, aliquet risus. Integer quis ornare sem, non sollicitudin augue. Sed cursus tellus libero. Pellentesque imperdiet tempus aliquam. Proin efficitur, nulla sed tempus laoreet, odio velit imperdiet lectus, ut convallis augue metus eleifend nibh. Suspendisse egestas non augue eu dapibus. Phasellus quis viverra odio. Sed ut blandit ipsum. Integer scelerisque sollicitudin diam eu suscipit. |
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 @@ | ||
the guard is: ${if (guard) "TRUE" else "FALSE"} |