|
| 1 | +// This file was automatically generated from customising-output.md by Knit tool. Do not edit. |
| 2 | +@file:Suppress("JSUnusedLocalSymbols") |
| 3 | +package dev.adamko.kxstsgen.example.test |
| 4 | + |
| 5 | +import dev.adamko.kxstsgen.util.* |
| 6 | +import io.kotest.core.spec.style.* |
| 7 | +import io.kotest.matchers.* |
| 8 | +import kotlinx.knit.test.* |
| 9 | + |
| 10 | +class CustomisingOutputTest : FunSpec({ |
| 11 | + |
| 12 | + tags(Knit) |
| 13 | + |
| 14 | + context("ExampleCustomisingOutput01") { |
| 15 | + val actual = captureOutput("ExampleCustomisingOutput01") { |
| 16 | + dev.adamko.kxstsgen.example.exampleCustomisingOutput01.main() |
| 17 | + }.normalizeJoin() |
| 18 | + |
| 19 | + test("expect actual matches TypeScript") { |
| 20 | + actual.shouldBe( |
| 21 | + """ |
| 22 | + |export interface Item { |
| 23 | + | price: Double; |
| 24 | + | count: number; |
| 25 | + |} |
| 26 | + | |
| 27 | + |export type Double = double; // assume that 'double' will be provided by another library |
| 28 | + """.trimMargin() |
| 29 | + .normalize() |
| 30 | + ) |
| 31 | + } |
| 32 | + |
| 33 | + // TS_COMPILE_OFF |
| 34 | + // test("expect actual compiles").config(tags = tsCompile) { |
| 35 | + // actual.shouldTypeScriptCompile() |
| 36 | + // } |
| 37 | + } |
| 38 | + |
| 39 | + context("ExampleCustomisingOutput02") { |
| 40 | + val actual = captureOutput("ExampleCustomisingOutput02") { |
| 41 | + dev.adamko.kxstsgen.example.exampleCustomisingOutput02.main() |
| 42 | + }.normalizeJoin() |
| 43 | + |
| 44 | + test("expect actual matches TypeScript") { |
| 45 | + actual.shouldBe( |
| 46 | + """ |
| 47 | + |export interface ItemHolder { |
| 48 | + | item: Item; |
| 49 | + |} |
| 50 | + | |
| 51 | + |export interface Item { |
| 52 | + | count?: UInt | null; |
| 53 | + |} |
| 54 | + | |
| 55 | + |export type UInt = uint; |
| 56 | + """.trimMargin() |
| 57 | + .normalize() |
| 58 | + ) |
| 59 | + } |
| 60 | + |
| 61 | + // TS_COMPILE_OFF |
| 62 | + // test("expect actual compiles").config(tags = tsCompile) { |
| 63 | + // actual.shouldTypeScriptCompile() |
| 64 | + // } |
| 65 | + } |
| 66 | + |
| 67 | + context("ExampleCustomisingOutput03") { |
| 68 | + val actual = captureOutput("ExampleCustomisingOutput03") { |
| 69 | + dev.adamko.kxstsgen.example.exampleCustomisingOutput03.main() |
| 70 | + }.normalizeJoin() |
| 71 | + |
| 72 | + test("expect actual matches TypeScript") { |
| 73 | + actual.shouldBe( |
| 74 | + """ |
| 75 | + |export interface ItemHolder { |
| 76 | + | item: Item; |
| 77 | + | tick: Tick | null; |
| 78 | + |} |
| 79 | + | |
| 80 | + |export interface Item { |
| 81 | + | count?: UInt | null; |
| 82 | + |} |
| 83 | + | |
| 84 | + |export type Tick = UInt; |
| 85 | + | |
| 86 | + |export type UInt = uint; |
| 87 | + """.trimMargin() |
| 88 | + .normalize() |
| 89 | + ) |
| 90 | + } |
| 91 | + |
| 92 | + // TS_COMPILE_OFF |
| 93 | + // test("expect actual compiles").config(tags = tsCompile) { |
| 94 | + // actual.shouldTypeScriptCompile() |
| 95 | + // } |
| 96 | + } |
| 97 | +}) |
0 commit comments