-
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
fb05cbc
commit ffc32b1
Showing
3 changed files
with
35 additions
and
8 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
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 StartFormat : ZplCommand { | ||
override val command: CharSequence = "^XA" | ||
} | ||
|
||
/** | ||
* Starts the label format. | ||
*/ | ||
fun ZplBuilder.startFormat() { | ||
command(StartFormat) | ||
} |
25 changes: 25 additions & 0 deletions
25
src/test/kotlin/info/mking/k2zpl/command/StartFormatTest.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 StartFormatTest : DescribeSpec({ | ||
isolationMode = IsolationMode.InstancePerLeaf | ||
|
||
describe("StartFormat") { | ||
it("outputs correct command") { | ||
StartFormat.testBuildString() shouldBe "^XA" | ||
} | ||
} | ||
describe("startFormat extension function") { | ||
it("outputs correct command") { | ||
val result = k2zpl { | ||
startFormat() | ||
} | ||
result shouldBe "^XA\n" | ||
} | ||
} | ||
}) |