From d41d0e54446c0724c258cc15f900631184699716 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 21 Nov 2025 17:32:21 -0400 Subject: [PATCH] Exit with code 2 on "expected" errors on `lint`, `fmt`, and `test` Signed-off-by: Juan Cruz Viotti --- src/command_fmt.cc | 4 +++- src/command_lint.cc | 16 ++++++++++++---- src/command_test.cc | 4 +++- test/format/fail_check_many.sh | 2 +- test/format/fail_check_many_json.sh | 2 +- test/format/fail_check_single.sh | 2 +- test/format/fail_check_single_indentation.sh | 2 +- test/format/fail_check_single_json.sh | 2 +- .../format/fail_check_single_json_indentation.sh | 2 +- test/lint/fail_lint.sh | 2 +- test/lint/fail_lint_default.sh | 2 +- test/lint/fail_lint_default_dialect.sh | 2 +- test/lint/fail_lint_default_dialect_config.sh | 2 +- .../fail_lint_default_dialect_config_relative.sh | 2 +- test/lint/fail_lint_directory_json.sh | 2 +- test/lint/fail_lint_directory_unresolvable.sh | 1 - .../fail_lint_directory_unresolvable_dialect.sh | 1 - .../lint/fail_lint_directory_unresolvable_fix.sh | 1 - test/lint/fail_lint_disable_many.sh | 2 +- test/lint/fail_lint_disable_one.sh | 2 +- test/lint/fail_lint_disable_one_verbose.sh | 2 +- test/lint/fail_lint_disable_unknown_verbose.sh | 2 +- test/lint/fail_lint_examples.sh | 2 +- test/lint/fail_lint_invalid_embedded_resource.sh | 2 +- test/lint/fail_lint_json.sh | 2 +- test/lint/fail_lint_only.sh | 2 +- test/lint/fail_lint_with_id.sh | 2 +- test/lint/fail_lint_yaml.sh | 2 +- test/test/fail_anyof.sh | 2 +- test/test/fail_false_single_resolve.sh | 2 +- test/test/fail_false_single_resolve_verbose.sh | 2 +- test/test/fail_multi_resolve.sh | 2 +- test/test/fail_multi_resolve_verbose.sh | 2 +- test/test/fail_multi_test.sh | 2 +- test/test/fail_true_resolve_fragment.sh | 2 +- test/test/fail_true_single_resolve.sh | 2 +- test/test/fail_true_single_resolve_verbose.sh | 2 +- 37 files changed, 49 insertions(+), 40 deletions(-) diff --git a/src/command_fmt.cc b/src/command_fmt.cc index cf31ea2a..05f6a004 100644 --- a/src/command_fmt.cc +++ b/src/command_fmt.cc @@ -96,6 +96,8 @@ auto sourcemeta::jsonschema::fmt(const sourcemeta::core::Options &options) << "\n"; } - throw Fail{EXIT_FAILURE}; + // Report a different exit code for formatting check failures, to + // distinguish them from other errors + throw Fail{2}; } } diff --git a/src/command_lint.cc b/src/command_lint.cc index ce278920..92036eff 100644 --- a/src/command_lint.cc +++ b/src/command_lint.cc @@ -238,7 +238,8 @@ auto sourcemeta::jsonschema::lint(const sourcemeta::core::Options &options) output << "\n"; } } else { - result = false; + // Exception was caught - exit immediately with error code 1 + throw Fail{EXIT_FAILURE}; } } } else { @@ -263,7 +264,8 @@ auto sourcemeta::jsonschema::lint(const sourcemeta::core::Options &options) if (subresult.first) { return EXIT_SUCCESS; } else { - return EXIT_FAILURE; + // Return 2 for logical lint failures + return 2; } } catch (const sourcemeta::core::SchemaUnknownBaseDialectError &) { throw FileError( @@ -274,8 +276,12 @@ auto sourcemeta::jsonschema::lint(const sourcemeta::core::Options &options) } }); - if (wrapper_result != EXIT_SUCCESS) { + if (wrapper_result == 2) { + // Logical lint failure result = false; + } else if (wrapper_result != EXIT_SUCCESS) { + // Exception was caught - exit immediately with error code 1 + throw Fail{EXIT_FAILURE}; } } } @@ -299,6 +305,8 @@ auto sourcemeta::jsonschema::lint(const sourcemeta::core::Options &options) } if (!result) { - throw Fail{EXIT_FAILURE}; + // Report a different exit code for linting failures, to + // distinguish them from other errors + throw Fail{2}; } } diff --git a/src/command_test.cc b/src/command_test.cc index 8b2a5934..98a06c80 100644 --- a/src/command_test.cc +++ b/src/command_test.cc @@ -250,6 +250,8 @@ auto sourcemeta::jsonschema::test(const sourcemeta::core::Options &options) } if (!result) { - throw Fail{EXIT_FAILURE}; + // Report a different exit code for test failures, to + // distinguish them from other errors + throw Fail{2}; } } diff --git a/test/format/fail_check_many.sh b/test/format/fail_check_many.sh index b4825781..c4aafb16 100755 --- a/test/format/fail_check_many.sh +++ b/test/format/fail_check_many.sh @@ -30,7 +30,7 @@ cat << 'EOF' > "$TMP/schemas/3.json" EOF "$1" fmt "$TMP/schemas" --check >"$TMP/output.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" fail: $(realpath "$TMP")/schemas/1.json diff --git a/test/format/fail_check_many_json.sh b/test/format/fail_check_many_json.sh index 335bc427..99302db3 100755 --- a/test/format/fail_check_many_json.sh +++ b/test/format/fail_check_many_json.sh @@ -30,7 +30,7 @@ cat << 'EOF' > "$TMP/schemas/3.json" EOF "$1" fmt "$TMP/schemas" --check --json >"$TMP/output.json" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.json" { diff --git a/test/format/fail_check_single.sh b/test/format/fail_check_single.sh index ff5440fc..142d52a2 100755 --- a/test/format/fail_check_single.sh +++ b/test/format/fail_check_single.sh @@ -15,7 +15,7 @@ cat << 'EOF' > "$TMP/schema.json" EOF "$1" fmt "$TMP/schema.json" --check >"$TMP/output.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" fail: $(realpath "$TMP")/schema.json diff --git a/test/format/fail_check_single_indentation.sh b/test/format/fail_check_single_indentation.sh index bf7578df..610c4d43 100755 --- a/test/format/fail_check_single_indentation.sh +++ b/test/format/fail_check_single_indentation.sh @@ -15,7 +15,7 @@ cat << 'EOF' > "$TMP/schema.json" EOF "$1" fmt "$TMP/schema.json" --indentation 4 --check >"$TMP/output.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" fail: $(realpath "$TMP")/schema.json diff --git a/test/format/fail_check_single_json.sh b/test/format/fail_check_single_json.sh index 64156e2b..875c42f8 100755 --- a/test/format/fail_check_single_json.sh +++ b/test/format/fail_check_single_json.sh @@ -18,7 +18,7 @@ EOF "$1" fmt "$TMP/this/is/a/very/very/very/long/path/schema.json" \ --check --json >"$TMP/output.json" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.json" { diff --git a/test/format/fail_check_single_json_indentation.sh b/test/format/fail_check_single_json_indentation.sh index bd776ece..e3fbca36 100755 --- a/test/format/fail_check_single_json_indentation.sh +++ b/test/format/fail_check_single_json_indentation.sh @@ -18,7 +18,7 @@ EOF "$1" fmt "$TMP/this/is/a/very/very/very/long/path/schema.json" \ --check --json --indentation 4 >"$TMP/output.json" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.json" { diff --git a/test/lint/fail_lint.sh b/test/lint/fail_lint.sh index cbc25772..17e4635a 100755 --- a/test/lint/fail_lint.sh +++ b/test/lint/fail_lint.sh @@ -17,7 +17,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:4:3: diff --git a/test/lint/fail_lint_default.sh b/test/lint/fail_lint_default.sh index 2f2c93e2..3772f418 100755 --- a/test/lint/fail_lint_default.sh +++ b/test/lint/fail_lint_default.sh @@ -21,7 +21,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:6:7: diff --git a/test/lint/fail_lint_default_dialect.sh b/test/lint/fail_lint_default_dialect.sh index 3a0ef638..cbded210 100755 --- a/test/lint/fail_lint_default_dialect.sh +++ b/test/lint/fail_lint_default_dialect.sh @@ -18,7 +18,7 @@ cd "$TMP" "$1" lint "$TMP/schema.json" \ --default-dialect "http://json-schema.org/draft-04/schema#" \ >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:3:3: diff --git a/test/lint/fail_lint_default_dialect_config.sh b/test/lint/fail_lint_default_dialect_config.sh index 94729e36..280206b1 100755 --- a/test/lint/fail_lint_default_dialect_config.sh +++ b/test/lint/fail_lint_default_dialect_config.sh @@ -23,7 +23,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" --verbose \ >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" Using configuration file: $(realpath "$TMP")/jsonschema.json diff --git a/test/lint/fail_lint_default_dialect_config_relative.sh b/test/lint/fail_lint_default_dialect_config_relative.sh index e221f9e2..3c010c6d 100755 --- a/test/lint/fail_lint_default_dialect_config_relative.sh +++ b/test/lint/fail_lint_default_dialect_config_relative.sh @@ -23,7 +23,7 @@ EOF cd "$TMP" "$1" lint schema.json --verbose \ >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" Using configuration file: $(realpath "$TMP")/jsonschema.json diff --git a/test/lint/fail_lint_directory_json.sh b/test/lint/fail_lint_directory_json.sh index e5460c79..2404c4e5 100755 --- a/test/lint/fail_lint_directory_json.sh +++ b/test/lint/fail_lint_directory_json.sh @@ -24,7 +24,7 @@ cat << 'EOF' > "$TMP/schemas/bar.json" EOF "$1" lint "$TMP/schemas" --json >"$TMP/output.json" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.json" { diff --git a/test/lint/fail_lint_directory_unresolvable.sh b/test/lint/fail_lint_directory_unresolvable.sh index 7228bf8e..ddf831c4 100755 --- a/test/lint/fail_lint_directory_unresolvable.sh +++ b/test/lint/fail_lint_directory_unresolvable.sh @@ -38,7 +38,6 @@ error: Could not resolve the reference to an external schema at file path $(realpath "$TMP")/baz.json This is likely because you forgot to import such schema using \`--resolve/-r\` -Linting: $(realpath "$TMP")/foo.json EOF diff "$TMP/output.txt" "$TMP/expected.txt" diff --git a/test/lint/fail_lint_directory_unresolvable_dialect.sh b/test/lint/fail_lint_directory_unresolvable_dialect.sh index 7873440f..eeef1f82 100755 --- a/test/lint/fail_lint_directory_unresolvable_dialect.sh +++ b/test/lint/fail_lint_directory_unresolvable_dialect.sh @@ -36,7 +36,6 @@ error: Could not resolve the metaschema of the schema at file path $(realpath "$TMP")/baz.json This is likely because you forgot to import such schema using \`--resolve/-r\` -Linting: $(realpath "$TMP")/foo.json EOF diff "$TMP/output.txt" "$TMP/expected.txt" diff --git a/test/lint/fail_lint_directory_unresolvable_fix.sh b/test/lint/fail_lint_directory_unresolvable_fix.sh index a83c3032..bcd70b69 100755 --- a/test/lint/fail_lint_directory_unresolvable_fix.sh +++ b/test/lint/fail_lint_directory_unresolvable_fix.sh @@ -38,7 +38,6 @@ error: Could not resolve the reference to an external schema at file path $(realpath "$TMP")/baz.json This is likely because you forgot to import such schema using \`--resolve/-r\` -Linting: $(realpath "$TMP")/foo.json EOF diff "$TMP/output.txt" "$TMP/expected.txt" diff --git a/test/lint/fail_lint_disable_many.sh b/test/lint/fail_lint_disable_many.sh index c303fc97..3abc1501 100755 --- a/test/lint/fail_lint_disable_many.sh +++ b/test/lint/fail_lint_disable_many.sh @@ -18,7 +18,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" --exclude enum_to_const -x enum_with_type >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:4:3: diff --git a/test/lint/fail_lint_disable_one.sh b/test/lint/fail_lint_disable_one.sh index 5b843338..1a034258 100755 --- a/test/lint/fail_lint_disable_one.sh +++ b/test/lint/fail_lint_disable_one.sh @@ -18,7 +18,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" --exclude enum_to_const >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:4:3: diff --git a/test/lint/fail_lint_disable_one_verbose.sh b/test/lint/fail_lint_disable_one_verbose.sh index 40c6b705..ffae14b7 100755 --- a/test/lint/fail_lint_disable_one_verbose.sh +++ b/test/lint/fail_lint_disable_one_verbose.sh @@ -18,7 +18,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" --verbose --exclude enum_to_const >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" Disabling rule: enum_to_const diff --git a/test/lint/fail_lint_disable_unknown_verbose.sh b/test/lint/fail_lint_disable_unknown_verbose.sh index 85cd9c74..46b50ae1 100755 --- a/test/lint/fail_lint_disable_unknown_verbose.sh +++ b/test/lint/fail_lint_disable_unknown_verbose.sh @@ -18,7 +18,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" --verbose --exclude foo_bar >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" warning: Cannot exclude unknown rule: foo_bar diff --git a/test/lint/fail_lint_examples.sh b/test/lint/fail_lint_examples.sh index e661282f..8e420ef4 100755 --- a/test/lint/fail_lint_examples.sh +++ b/test/lint/fail_lint_examples.sh @@ -21,7 +21,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:6:21: diff --git a/test/lint/fail_lint_invalid_embedded_resource.sh b/test/lint/fail_lint_invalid_embedded_resource.sh index 3ffa2394..4b1da7f5 100755 --- a/test/lint/fail_lint_invalid_embedded_resource.sh +++ b/test/lint/fail_lint_invalid_embedded_resource.sh @@ -27,7 +27,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat "$TMP/stderr.txt" diff --git a/test/lint/fail_lint_json.sh b/test/lint/fail_lint_json.sh index 4368b086..add6304b 100755 --- a/test/lint/fail_lint_json.sh +++ b/test/lint/fail_lint_json.sh @@ -16,7 +16,7 @@ cat << 'EOF' > "$TMP/schema.json" EOF "$1" lint "$TMP/schema.json" --json >"$TMP/output.json" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.json" { diff --git a/test/lint/fail_lint_only.sh b/test/lint/fail_lint_only.sh index c158bf84..c8200e97 100755 --- a/test/lint/fail_lint_only.sh +++ b/test/lint/fail_lint_only.sh @@ -18,7 +18,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.json:4:3: diff --git a/test/lint/fail_lint_with_id.sh b/test/lint/fail_lint_with_id.sh index 5a7c8eea..f0c8b0e4 100755 --- a/test/lint/fail_lint_with_id.sh +++ b/test/lint/fail_lint_with_id.sh @@ -17,7 +17,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.json" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << 'EOF' > "$TMP/expected.txt" schema.json:4:3: diff --git a/test/lint/fail_lint_yaml.sh b/test/lint/fail_lint_yaml.sh index f29a2ba3..1a78c47a 100755 --- a/test/lint/fail_lint_yaml.sh +++ b/test/lint/fail_lint_yaml.sh @@ -15,7 +15,7 @@ EOF cd "$TMP" "$1" lint "$TMP/schema.yaml" >"$TMP/stderr.txt" 2>&1 && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" schema.yaml:3:1: diff --git a/test/test/fail_anyof.sh b/test/test/fail_anyof.sh index 7ccb9347..44449412 100755 --- a/test/test/fail_anyof.sh +++ b/test/test/fail_anyof.sh @@ -39,7 +39,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat "$TMP/output.txt" diff --git a/test/test/fail_false_single_resolve.sh b/test/test/fail_false_single_resolve.sh index 6b54d622..0810c708 100755 --- a/test/test/fail_false_single_resolve.sh +++ b/test/test/fail_false_single_resolve.sh @@ -40,7 +40,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" $(realpath "$TMP")/test.json: diff --git a/test/test/fail_false_single_resolve_verbose.sh b/test/test/fail_false_single_resolve_verbose.sh index a3870394..af1010dc 100755 --- a/test/test/fail_false_single_resolve_verbose.sh +++ b/test/test/fail_false_single_resolve_verbose.sh @@ -40,7 +40,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" --verbose 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" Detecting schema resources from file: $(realpath "$TMP")/schema.json diff --git a/test/test/fail_multi_resolve.sh b/test/test/fail_multi_resolve.sh index d56417c2..97dd2f4c 100755 --- a/test/test/fail_multi_resolve.sh +++ b/test/test/fail_multi_resolve.sh @@ -45,7 +45,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" $(realpath "$TMP")/test.json: diff --git a/test/test/fail_multi_resolve_verbose.sh b/test/test/fail_multi_resolve_verbose.sh index de653774..fb533a8f 100755 --- a/test/test/fail_multi_resolve_verbose.sh +++ b/test/test/fail_multi_resolve_verbose.sh @@ -45,7 +45,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" --verbose 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" Detecting schema resources from file: $(realpath "$TMP")/schema.json diff --git a/test/test/fail_multi_test.sh b/test/test/fail_multi_test.sh index f1740bf6..9e23ac13 100755 --- a/test/test/fail_multi_test.sh +++ b/test/test/fail_multi_test.sh @@ -63,7 +63,7 @@ EOF "$1" test "$TMP/tests" --resolve "$TMP/schema.json" 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" $(realpath "$TMP")/tests/1.json: diff --git a/test/test/fail_true_resolve_fragment.sh b/test/test/fail_true_resolve_fragment.sh index 300ef2c1..b83befe5 100755 --- a/test/test/fail_true_resolve_fragment.sh +++ b/test/test/fail_true_resolve_fragment.sh @@ -33,7 +33,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" $(realpath "$TMP")/test.json: diff --git a/test/test/fail_true_single_resolve.sh b/test/test/fail_true_single_resolve.sh index 92c231a1..736cea08 100755 --- a/test/test/fail_true_single_resolve.sh +++ b/test/test/fail_true_single_resolve.sh @@ -40,7 +40,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" $(realpath "$TMP")/test.json: diff --git a/test/test/fail_true_single_resolve_verbose.sh b/test/test/fail_true_single_resolve_verbose.sh index 7b541114..61dae35b 100755 --- a/test/test/fail_true_single_resolve_verbose.sh +++ b/test/test/fail_true_single_resolve_verbose.sh @@ -40,7 +40,7 @@ EOF "$1" test "$TMP/test.json" --resolve "$TMP/schema.json" --verbose 1> "$TMP/output.txt" 2>&1 \ && CODE="$?" || CODE="$?" -test "$CODE" = "1" || exit 1 +test "$CODE" = "2" || exit 1 cat << EOF > "$TMP/expected.txt" Detecting schema resources from file: $(realpath "$TMP")/schema.json