diff --git a/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt b/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt index 7d32006..6af63df 100644 --- a/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt +++ b/src/main/kotlin/info/mking/k2zpl/builder/Extensions.kt @@ -4,7 +4,6 @@ package info.mking.k2zpl.builder import info.mking.k2zpl.command.EndFormat import info.mking.k2zpl.command.FieldData -import info.mking.k2zpl.command.FieldSeparator import info.mking.k2zpl.command.LabelLength import info.mking.k2zpl.command.PrintQuantity import info.mking.k2zpl.command.StartFormat @@ -12,13 +11,6 @@ import info.mking.k2zpl.command.ZplCommand import info.mking.k2zpl.command.options.ZplFont import info.mking.k2zpl.command.options.ZplYesNo -/** - * Adds a field separator. - */ -fun ZplBuilder.fieldSeparator() { - command(FieldSeparator) -} - /** * Adds field data. * @param data The data to be added to the field. diff --git a/src/main/kotlin/info/mking/k2zpl/builder/ZplBuilder.kt b/src/main/kotlin/info/mking/k2zpl/builder/ZplBuilder.kt index ccfb572..9925178 100644 --- a/src/main/kotlin/info/mking/k2zpl/builder/ZplBuilder.kt +++ b/src/main/kotlin/info/mking/k2zpl/builder/ZplBuilder.kt @@ -6,6 +6,7 @@ import info.mking.k2zpl.command.CustomCommand import info.mking.k2zpl.command.Font import info.mking.k2zpl.command.ZplCommand import info.mking.k2zpl.command.fieldOrigin +import info.mking.k2zpl.command.fieldSeparator import info.mking.k2zpl.command.font import info.mking.k2zpl.command.options.ZplDpiSetting import info.mking.k2zpl.command.options.ZplFieldOrientation diff --git a/src/main/kotlin/info/mking/k2zpl/command/BarCode.kt b/src/main/kotlin/info/mking/k2zpl/command/BarCode.kt index 5538095..baea248 100644 --- a/src/main/kotlin/info/mking/k2zpl/command/BarCode.kt +++ b/src/main/kotlin/info/mking/k2zpl/command/BarCode.kt @@ -3,7 +3,6 @@ package info.mking.k2zpl.command import info.mking.k2zpl.builder.ZplBuilder import info.mking.k2zpl.builder.command import info.mking.k2zpl.builder.fieldData -import info.mking.k2zpl.builder.fieldSeparator import info.mking.k2zpl.builder.toZplYesNo import info.mking.k2zpl.command.options.ZplBarcodeType import info.mking.k2zpl.command.options.ZplFieldOrientation diff --git a/src/main/kotlin/info/mking/k2zpl/command/FieldSeparator.kt b/src/main/kotlin/info/mking/k2zpl/command/FieldSeparator.kt index 484d998..4c6171d 100644 --- a/src/main/kotlin/info/mking/k2zpl/command/FieldSeparator.kt +++ b/src/main/kotlin/info/mking/k2zpl/command/FieldSeparator.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 FieldSeparator : ZplCommand { override val command: CharSequence = "^FS" +} + +/** + * Adds a field separator. + */ +fun ZplBuilder.fieldSeparator() { + command(FieldSeparator) } \ No newline at end of file diff --git a/src/test/kotlin/info/mking/k2zpl/command/FieldSeparatorTest.kt b/src/test/kotlin/info/mking/k2zpl/command/FieldSeparatorTest.kt new file mode 100644 index 0000000..d28ecb9 --- /dev/null +++ b/src/test/kotlin/info/mking/k2zpl/command/FieldSeparatorTest.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 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" + } + } +}) \ No newline at end of file