-
Notifications
You must be signed in to change notification settings - Fork 81
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 #166 from olafurpg/compile-only
Implement `compile-only` modifier for JVM and Scala.js.
- Loading branch information
Showing
15 changed files
with
231 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
version=2.0.0-RC7 | ||
maxColumn = 100 | ||
project.git=true | ||
align = none | ||
|
Binary file not shown.
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
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
82 changes: 82 additions & 0 deletions
82
tests/unit/src/test/scala/tests/markdown/CompileOnlySuite.scala
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,82 @@ | ||
package tests.markdown | ||
|
||
class CompileOnlySuite extends BaseMarkdownSuite { | ||
check( | ||
"compile-only", | ||
""" | ||
|```scala mdoc:compile-only | ||
|println(System.in.read()) | ||
|``` | ||
""".stripMargin, | ||
"""|```scala | ||
|println(System.in.read()) | ||
|``` | ||
""".stripMargin | ||
) | ||
|
||
check( | ||
"reuse", | ||
""" | ||
|```scala mdoc | ||
|val message = "Enter: " | ||
|``` | ||
|```scala mdoc:compile-only | ||
|println(message) | ||
|println(System.in.read()) | ||
|``` | ||
|```scala mdoc | ||
|println(message) | ||
|``` | ||
""".stripMargin, | ||
// assert it's possible to reference variables from non-compile-only blocks | ||
"""|```scala | ||
|val message = "Enter: " | ||
|// message: String = "Enter: " | ||
|``` | ||
| | ||
|```scala | ||
|println(message) | ||
|println(System.in.read()) | ||
|``` | ||
| | ||
|```scala | ||
|println(message) | ||
|// Enter: | ||
|``` | ||
""".stripMargin | ||
) | ||
|
||
checkError( | ||
"no-reuse", | ||
""" | ||
|```scala mdoc:compile-only | ||
|val message = "Enter: " | ||
|``` | ||
|```scala mdoc | ||
|println(message) | ||
|``` | ||
""".stripMargin, | ||
// assert it's not possible to reference variables from compile-only blocks | ||
"""|error: no-reuse.md:6:9: not found: value message | ||
|println(message) | ||
| ^^^^^^^ | ||
""".stripMargin | ||
) | ||
|
||
checkError( | ||
"error", | ||
""" | ||
|```scala mdoc:compile-only | ||
|val x: String = 42 | ||
|``` | ||
""".stripMargin, | ||
// Validate that compile errors are reported and fail the build. | ||
"""|error: error.md:3:17: type mismatch; | ||
| found : Int(42) | ||
| required: String | ||
|val x: String = 42 | ||
| ^^ | ||
""".stripMargin | ||
) | ||
|
||
} |
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
Oops, something went wrong.