diff --git a/src/ui.toit b/src/ui.toit index 9d5b1fa..66c3c2a 100644 --- a/src/ui.toit +++ b/src/ui.toit @@ -732,6 +732,9 @@ class JsonPrinter extends HumanPrinterBase: needs-structured --kind/int -> bool: return kind == Ui.RESULT + wants-human --kind/int -> bool: + return kind != Ui.RESULT + print_ str/string: print-on-stderr_ str diff --git a/tests/ui-test.toit b/tests/ui-test.toit index 6e1ca06..d9f94ef 100644 --- a/tests/ui-test.toit +++ b/tests/ui-test.toit @@ -370,3 +370,10 @@ test-json: ui.emit --error "some error" expect-equals "Error: some error\n" printer.stderr printer.reset + + expect ui.wants-structured // By default the kind is "Ui.RESULT". + expect (ui.wants-structured --kind=Ui.RESULT) + expect-not (ui.wants-structured --kind=Ui.INFO) + expect-not ui.wants-human // By default the kind is "Ui.RESULT". + expect-not (ui.wants-human --kind=Ui.RESULT) + expect (ui.wants-human --kind=Ui.INFO)