-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
84dacd8
commit e48c1a1
Showing
5 changed files
with
36 additions
and
9 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
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/info/mking/k2zpl/command/FieldSeparator.kt
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,5 +1,15 @@ | ||
package info.mking.k2zpl.command | ||
|
||
import info.mking.k2zpl.builder.ZplBuilder | ||
import info.mking.k2zpl.builder.command | ||
|
||
internal data object FieldSeparator : ZplCommand { | ||
override val command: CharSequence = "^FS" | ||
} | ||
|
||
/** | ||
* Adds a field separator. | ||
*/ | ||
fun ZplBuilder.fieldSeparator() { | ||
command(FieldSeparator) | ||
} |
25 changes: 25 additions & 0 deletions
25
src/test/kotlin/info/mking/k2zpl/command/FieldSeparatorTest.kt
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,25 @@ | ||
package info.mking.k2zpl.command | ||
|
||
import info.mking.k2zpl.k2zpl | ||
import info.mking.k2zpl.testBuildString | ||
import io.kotest.core.spec.IsolationMode | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import io.kotest.matchers.shouldBe | ||
|
||
class FieldSeparatorTest : DescribeSpec({ | ||
isolationMode = IsolationMode.InstancePerLeaf | ||
|
||
describe("FieldSeparator") { | ||
it("outputs correct command") { | ||
FieldSeparator.testBuildString() shouldBe "^FS" | ||
} | ||
} | ||
describe("fieldSeparator extension function") { | ||
it("outputs correct command") { | ||
val result = k2zpl { | ||
fieldSeparator() | ||
} | ||
result shouldBe "^FS\n" | ||
} | ||
} | ||
}) |