From 10481bbce0c03eea7c883ed33d35f7698d1823b2 Mon Sep 17 00:00:00 2001 From: "Ian G. Maia" Date: Fri, 21 Feb 2025 13:41:52 +0100 Subject: [PATCH] Fix `assert_result` arguments order Co-authored-by: Olivier Halligon --- .../test_any_match_patterns.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/pr_changed_files/test_any_match_patterns.sh b/tests/pr_changed_files/test_any_match_patterns.sh index d288c7e..4721e98 100755 --- a/tests/pr_changed_files/test_any_match_patterns.sh +++ b/tests/pr_changed_files/test_any_match_patterns.sh @@ -39,42 +39,42 @@ assert_result $result 0 "$output" "true" "Should match .swift files with --stdou # [Test] Match multiple patterns - exit code only output=$(pr_changed_files --any-match 'docs/*.md' '*.rb') result=$? -assert_result 0 $result "$output" "" "Should match multiple patterns" +assert_result $result 0 "$output" "" "Should match multiple patterns" # Test with stdout output=$(pr_changed_files --stdout --any-match 'docs/*.md' '*.rb') result=$? -assert_result 0 $result "$output" "true" "Should match multiple patterns with --stdout" +assert_result $result 0 "$output" "true" "Should match multiple patterns with --stdout" # [Test] Match files with spaces and special characters - exit code only output=$(pr_changed_files --any-match 'docs/read me.md' 'docs/special!@*#$chars.md') result=$? -assert_result 0 $result "$output" "" "Should match files with spaces and special characters" +assert_result $result 0 "$output" "" "Should match files with spaces and special characters" # Test with stdout output=$(pr_changed_files --stdout --any-match 'docs/read me.md' 'docs/special!@*#$chars.md') result=$? -assert_result 0 $result "$output" "true" "Should match files with spaces and special characters with --stdout" +assert_result $result 0 "$output" "true" "Should match files with spaces and special characters with --stdout" # [Test] No matches - exit code only output=$(pr_changed_files --any-match '*.js') result=$? -assert_result 1 $result "$output" "" "Should not match non-existent patterns" +assert_result $result 1 "$output" "" "Should not match non-existent patterns" # Test with stdout output=$(pr_changed_files --stdout --any-match '*.js') result=$? -assert_result 0 $result "$output" "false" "Should not match non-existent patterns with --stdout" +assert_result $result 0 "$output" "false" "Should not match non-existent patterns with --stdout" # [Test] Directory pattern - exit code only output=$(pr_changed_files --any-match 'docs/*') result=$? -assert_result 0 $result "$output" "" "Should match directory patterns" +assert_result $result 0 "$output" "" "Should match directory patterns" # Test with stdout output=$(pr_changed_files --stdout --any-match 'docs/*') result=$? -assert_result 0 $result "$output" "true" "Should match directory patterns with --stdout" +assert_result $result 0 "$output" "true" "Should match directory patterns with --stdout" # [Test] Exact pattern matching - exit code only echo "swiftfile" > swiftfile.txt @@ -83,11 +83,11 @@ git commit -m "Add file with swift in name" output=$(pr_changed_files --any-match '*.swift') result=$? -assert_result 0 $result "$output" "" "Should only match exact patterns" +assert_result $result 0 "$output" "" "Should only match exact patterns" # Test with stdout output=$(pr_changed_files --stdout --any-match '*.swift') result=$? -assert_result 0 $result "$output" "true" "Should only match exact patterns with --stdout" +assert_result $result 0 "$output" "true" "Should only match exact patterns with --stdout" echo "✅ Any-match pattern tests passed"