Skip to content

Commit

Permalink
Skip JS/IR tests that fail due to KT-43490 (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajalt authored Dec 27, 2022
1 parent e914dc1 commit 6a7ed4d
Show file tree
Hide file tree
Showing 18 changed files with 85 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.data.blocking.forAll
import io.kotest.data.row
Expand Down Expand Up @@ -126,6 +127,7 @@ class CliktCommandTest {
@Test
@JsName("command_usage")
fun `command usage`() {
if (skipDueToKT43490) return
class Parent : TestCommand(called = false) {
val arg by argument()
}
Expand Down Expand Up @@ -262,6 +264,7 @@ class CliktCommandTest {
c.parse("-f -g -i")
c.foo shouldBe true
c.args shouldBe listOf("-g", "-i")
if (skipDueToKT43490) return
shouldThrow<NoSuchOption> {
C(false).parse("-fgi")
}.message shouldBe "no such option: \"-g\""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.github.ajalt.clikt.parameters.arguments.multiple
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.matchers.should
import io.kotest.matchers.shouldBe
Expand Down Expand Up @@ -89,6 +90,7 @@ class ContextTest {
@Test
@JsName("default_help_option_names")
fun `default help option names`() {
if (skipDueToKT43490) return
class C : TestCommand()

shouldThrow<PrintHelpMessage> { C().parse("--help") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT33294
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.data.blocking.forAll
import io.kotest.data.row
Expand All @@ -24,6 +25,7 @@ class ArgumentTest {
@Test
@JsName("one_required_argument")
fun `one required argument`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val foo by argument()
}
Expand Down Expand Up @@ -112,6 +114,7 @@ class ArgumentTest {
@Test
@JsName("one_argument_nvalues_2")
fun `one argument nvalues=2`() {
if (skipDueToKT43490) return
class C : TestCommand() {
val x by argument().pair()
override fun run_() {
Expand Down Expand Up @@ -158,6 +161,7 @@ class ArgumentTest {
@Test
@JsName("misused_arguments_with_nvalues_2")
fun `misused arguments with nvalues=2`() {
if (skipDueToKT43490) return
class C : TestCommand() {
val x by argument().pair()
}
Expand All @@ -172,6 +176,7 @@ class ArgumentTest {
@Test
@JsName("misused_arguments_with_nvalues_3")
fun `misused arguments with nvalues=3`() {
if (skipDueToKT43490) return
class C : TestCommand() {
val x by argument().triple()
}
Expand Down Expand Up @@ -237,6 +242,7 @@ class ArgumentTest {
@Test
@JsName("one_required_argument_nvalues_minus_1_empty_argv")
fun `one required argument nvalues=-1 empty argv`() {
if (skipDueToKT43490) return
class C : TestCommand() {
val x by argument().multiple(required = true)
}
Expand Down Expand Up @@ -265,6 +271,7 @@ class ArgumentTest {
@Test
@JsName("two_arguments_nvalues_minus_1_1_empty_argv")
fun `two arguments nvalues=-1_1 empty argv`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val foo by argument().multiple()
val bar by argument()
Expand Down Expand Up @@ -296,6 +303,7 @@ class ArgumentTest {
@Test
@JsName("two_arguments_nvalues_1_minus_1_empty_argv")
fun `two arguments nvalues=1_-1 empty argv`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val foo by argument()
val bar by argument().multiple()
Expand Down Expand Up @@ -325,6 +333,7 @@ class ArgumentTest {
@Test
@JsName("argument_validator_non_minus_null")
fun `argument validator non-null`() {
if (skipDueToKT43490) return
var called = false

class C : TestCommand() {
Expand Down Expand Up @@ -428,6 +437,7 @@ class ArgumentTest {
@Test
@JsName("convert_catches_exceptions")
fun `convert catches exceptions`() {
if (skipDueToKT43490) return
class C : TestCommand() {
val x by argument().convert {
when (it) {
Expand Down Expand Up @@ -487,6 +497,7 @@ class ArgumentTest {
@Test
@JsName("punctuation_in_arg_prefix_unix_style_error")
fun `punctuation in arg prefix unix style error`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val x by argument()
}
Expand Down Expand Up @@ -516,6 +527,7 @@ class ArgumentTest {
@Test
@JsName("punctuation_in_arg_prefix_windows_style_error")
fun `punctuation in arg prefix windows style error`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
init {
context { helpOptionNames = setOf("/help") }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.TestSource
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.data.blocking.forAll
import io.kotest.data.row
Expand Down Expand Up @@ -225,6 +226,7 @@ class EnvvarOptionsTest {
C().withEnv().parse("").opt shouldBe "y"

env["BAR"] = "z"
if (skipDueToKT43490) return
shouldThrow<MutuallyExclusiveGroupException> {
C().withEnv().parse("")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT33294
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.data.blocking.forAll
import io.kotest.data.row
Expand All @@ -33,6 +34,7 @@ class OptionTest {
row("--car", "no such option: \"--car\". Did you mean \"--bar\"?"),
row("--ba", "no such option: \"--ba\". (Possible options: --bar, --baz)")
) { argv, message ->
if (skipDueToKT43490) return@forAll
class C : TestCommand(called = false) {
val foo by option()
val bar by option()
Expand All @@ -52,6 +54,7 @@ class OptionTest {
row("-foo", "no such option: \"-f\". Did you mean \"--foo\"?"),
row("-oof", "no such option: \"-f\". Did you mean \"--oof\"?"),
) { argv, message ->
if (skipDueToKT43490) return@forAll
class C : TestCommand(called = false) {
val short by option("-o").flag()
val long by option()
Expand Down Expand Up @@ -203,6 +206,7 @@ class OptionTest {
@Test
@JsName("two_options_nvalues_2_usage_errors")
fun `two options nvalues=2 usage errors`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val x by option("-x", "--xx").pair()
val y by option("-y", "--yy").pair()
Expand Down Expand Up @@ -313,6 +317,7 @@ class OptionTest {
}

C().parse("--x").x shouldBe E.A
if (skipDueToKT43490) return
shouldThrow<UsageError> { C().parse("--no-x") }
}

Expand Down Expand Up @@ -346,6 +351,7 @@ class OptionTest {

C().parse("-x").x shouldBe 1
C().parse("-xx").x shouldBe 2
if (skipDueToKT43490) return
shouldThrow<MissingOption> { C().parse("") }
}

Expand Down Expand Up @@ -460,6 +466,7 @@ class OptionTest {

C().parse("--x=foo")

if (skipDueToKT43490) return
shouldThrow<MissingOption> {
C().parse("")
}.message shouldBe "Missing option \"--x\""
Expand Down Expand Up @@ -556,6 +563,7 @@ class OptionTest {
C(true).apply { parse("--x 1"); x shouldBe listOf("1") }
C(true).apply { parse("--x 2 --x 3"); x shouldBe listOf("2", "3") }

if (skipDueToKT43490) return
shouldThrow<MissingOption> { C(false).parse("") }
.message shouldBe "Missing option \"--x\""
}
Expand Down Expand Up @@ -620,6 +628,7 @@ class OptionTest {
row("--y=foo --w=bar", "Invalid value for \"--w\": fail bar")
) { argv, message ->
if (skipDueToKT33294) return@forAll
if (skipDueToKT43490) return@forAll

class C : TestCommand() {
val x by option().check { it == "foo" }
Expand All @@ -636,6 +645,7 @@ class OptionTest {
@JsName("option_validator_required")
fun `option validator required`() {
if (skipDueToKT33294) return
if (skipDueToKT43490) return

var called = false

Expand Down Expand Up @@ -681,6 +691,7 @@ class OptionTest {
@Test
@JsName("convert_catches_exceptions")
fun `convert catches exceptions`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
init {
context { allowInterspersedArgs = false }
Expand Down Expand Up @@ -818,6 +829,7 @@ class OptionTest {
@Test
@JsName("deprecated_error_option")
fun `deprecated error option`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val x by option().flag().deprecated(error = true)
val y by option().deprecated("err", error = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.data.blocking.forAll
import io.kotest.data.row
Expand Down Expand Up @@ -244,6 +245,7 @@ class SubcommandTest {
@Test
@JsName("subcommand_usage")
fun `subcommand usage`() {
if (skipDueToKT43490) return
class Parent : TestCommand()
class Child : TestCommand()
class Grandchild : TestCommand(called = false) {
Expand All @@ -268,6 +270,7 @@ class SubcommandTest {
row("bart", "no such subcommand: \"bart\". Did you mean \"bar\"?"),
row("ba", "no such subcommand: \"ba\". (Possible subcommands: bar, baz)")
) { argv, message ->
if (skipDueToKT43490) return@forAll
shouldThrow<NoSuchSubcommand> {
TestCommand()
.subcommands(TestCommand(name = "foo"), TestCommand(name = "bar"), TestCommand(name = "baz"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.testing.TestCommand
import com.github.ajalt.clikt.testing.parse
import com.github.ajalt.clikt.testing.skipDueToKT33294
import com.github.ajalt.clikt.testing.skipDueToKT43490
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.data.blocking.forAll
import io.kotest.data.row
Expand Down Expand Up @@ -67,6 +68,7 @@ class OptionGroupsTest {

C().parse("--x=foo")

if (skipDueToKT43490) return
shouldThrow<MissingOption> {
C().parse("")
}.message shouldBe "Missing option \"--x\""
Expand Down Expand Up @@ -123,6 +125,7 @@ class OptionGroupsTest {
C(true).apply { parse("--x=1") }.g shouldBe "1"
C(true).apply { parse("--y=1 --y=2") }.g shouldBe "2"

if (skipDueToKT43490) return
shouldThrow<MutuallyExclusiveGroupException> { C(false).parse("--x=1 --y=2") }
.message shouldBe "option --x cannot be used with --y or --z"

Expand All @@ -142,6 +145,7 @@ class OptionGroupsTest {

C(true).apply { parse("--x=1") }.g shouldBe Sealed.Sealed1

if (skipDueToKT43490) return
shouldThrow<BadParameterValue> { C(false).parse("--y=1") }
.message should startWith("Invalid value for \"--y\"")
}
Expand Down Expand Up @@ -259,6 +263,7 @@ class OptionGroupsTest {
@Test
@JsName("co_occurring_option_group_enforcement")
fun `co-occurring option group enforcement`() {
if (skipDueToKT43490) return
class GGG : OptionGroup() {
val x by option().required()
val y by option()
Expand All @@ -275,6 +280,7 @@ class OptionGroupsTest {
@Test
@JsName("co_occurring_option_group_with_no_required_options")
fun `co-occurring option group with no required options`() {
if (skipDueToKT43490) return
class GGG : OptionGroup() {
val x by option()
val y by option()
Expand Down Expand Up @@ -321,6 +327,7 @@ class OptionGroupsTest {
}
}

if (skipDueToKT43490) return
shouldThrow<BadParameterValue> { C().parse("--g=3") }
.message shouldBe "Invalid value for \"--g\": invalid choice: 3. (choose from 1, 2)"
}
Expand Down Expand Up @@ -367,6 +374,7 @@ class OptionGroupsTest {
row("--x=2", null, false)
) { argv, ex, ec ->
if (skipDueToKT33294) return@forAll
if (skipDueToKT43490) return@forAll

class G : OptionGroup() {
val x by option().int().validate {
Expand Down Expand Up @@ -395,6 +403,7 @@ class OptionGroupsTest {
row("--x=2 --y=1", null, false, "Invalid value for \"--x\": fail")
) { argv, ex, ec, em ->
if (skipDueToKT33294) return@forAll
if (skipDueToKT43490) return@forAll

class G : OptionGroup() {
val x by option().int().check("fail") { it == 1 }
Expand Down Expand Up @@ -423,6 +432,7 @@ class OptionGroupsTest {
row("--y=2", 2, false)
) { argv, eg, ec ->
if (skipDueToKT33294) return@forAll
if (skipDueToKT43490) return@forAll

class C : TestCommand(called = ec) {
val g by mutuallyExclusiveOptions(
Expand Down Expand Up @@ -477,6 +487,7 @@ class OptionGroupsTest {
@Test
@JsName("groupSwitch_with_defaultByName_with_invalid_name")
fun `groupSwitch with defaultByName with invalid name`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val g by option().groupSwitch("--x" to Group1(), "--y" to Group2())
.defaultByName("--z")
Expand All @@ -487,6 +498,7 @@ class OptionGroupsTest {
@Test
@JsName("groupChoice_with_defaultByName_with_invalid_name")
fun `groupChoice with defaultByName with invalid name`() {
if (skipDueToKT43490) return
class C : TestCommand(called = false) {
val g by option().groupChoice("1" to Group1(), "2" to Group2())
.defaultByName("3")
Expand Down Expand Up @@ -572,6 +584,7 @@ class OptionGroupsTest {
C(0).parse("--opt=0")
C(0).parse("--g=a --opt=0")

if (skipDueToKT43490) return
shouldThrow<UsageError> { C(3).parse("--g=a --opt=3") }
shouldThrow<UsageError> { C(3).parse("--opt=3") }
}
Expand Down
Loading

0 comments on commit 6a7ed4d

Please sign in to comment.