diff --git a/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt b/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt index 8fe54b2..138e5ce 100644 --- a/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt +++ b/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt @@ -2,18 +2,10 @@ package info.mking.k2zpl.builder -import info.mking.k2zpl.command.EndFormat import info.mking.k2zpl.command.ZplCommand import info.mking.k2zpl.command.options.ZplFont import info.mking.k2zpl.command.options.ZplYesNo -/** - * Ends the label format. - */ -fun ZplBuilder.endFormat() { - command(EndFormat) -} - /** * Shortcut for addCommand */ diff --git a/src/main/kotlin/info/mking/k2zpl/command/EndFormat.kt b/src/main/kotlin/info/mking/k2zpl/command/EndFormat.kt index 708b4e7..64fe768 100644 --- a/src/main/kotlin/info/mking/k2zpl/command/EndFormat.kt +++ b/src/main/kotlin/info/mking/k2zpl/command/EndFormat.kt @@ -1,5 +1,15 @@ package info.mking.k2zpl.command +import info.mking.k2zpl.builder.ZplBuilder +import info.mking.k2zpl.builder.command + internal data object EndFormat : ZplCommand { override val command: CharSequence = "^XZ" +} + +/** + * Ends the label format. + */ +fun ZplBuilder.endFormat() { + command(EndFormat) } \ No newline at end of file diff --git a/src/test/kotlin/info/mking/k2zpl/command/EndFormatTest.kt b/src/test/kotlin/info/mking/k2zpl/command/EndFormatTest.kt new file mode 100644 index 0000000..1a35189 --- /dev/null +++ b/src/test/kotlin/info/mking/k2zpl/command/EndFormatTest.kt @@ -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 EndFormatTest : DescribeSpec({ + isolationMode = IsolationMode.InstancePerLeaf + + describe("EndFormat") { + it("outputs correct command") { + EndFormat.testBuildString() shouldBe "^XZ" + } + } + describe("endFormat extension fucntion") { + it("outputs correct command") { + val result = k2zpl { + endFormat() + } + result shouldBe "^XZ\n" + } + } +}) \ No newline at end of file