Skip to content

Commit

Permalink
Add more .include test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgio committed Jun 27, 2024
1 parent 64f9ae8 commit 7062517
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ fun include(
// Read file content
val file = file(context, path)
val raw = "\n" + file.readText()
// The initial line break is a workaround for an issue that may cause blocks at the beginning of the file
// to be not recognized as blocks - which happens in transitive inclusions (aka a nested .include called from an included file).

// Evaluate the Quarkdown source.
// This automatically converts the source into a value (e.g. a node, a string, a number, etc.)
Expand Down
12 changes: 12 additions & 0 deletions test/src/test/kotlin/eu/iamgio/quarkdown/test/FullPipelineTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -556,5 +556,17 @@ class FullPipelineTest {
it,
)
}

// Included file used as a value.
execute(
"""
.sum {.include {include/include-6.md}} {3}
""".trimIndent(),
) {
assertEquals(
"<p>8</p>",
it,
)
}
}
}
4 changes: 4 additions & 0 deletions test/src/test/resources/data/include/include-6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.function {mynumber}
.sum {3} {2}

.mynumber

0 comments on commit 7062517

Please sign in to comment.