|
70 | 70 | assert_eq "test_no_hardcoded_prefix" "0" "$hardcoded_count" |
71 | 71 |
|
72 | 72 | # --------------------------------------------------------------------------- |
73 | | -# Test 4: Script references read-config.sh for session.artifact_prefix |
| 73 | +# (Tests for read-config.sh reference, basename fallback, tr transform, and |
| 74 | +# ARTIFACT_PREFIX variable usage are covered behaviorally by tests 9-13 below: |
| 75 | +# derive_prefix edge cases prove the transformation, and the integration tests |
| 76 | +# prove config reading and fallback resolution work end-to-end.) |
74 | 77 | # --------------------------------------------------------------------------- |
75 | | -echo "Test 4: script reads session.artifact_prefix via read-config.sh" |
76 | | -reads_config=0 |
77 | | -if [ -f "$PLUGIN_SCRIPT" ]; then |
78 | | - if grep -qE 'read-config\.sh.*session\.artifact_prefix|session\.artifact_prefix.*read-config' "$PLUGIN_SCRIPT" 2>/dev/null; then |
79 | | - reads_config=1 |
80 | | - fi |
81 | | -fi |
82 | | -assert_eq "test_reads_config_session_artifact_prefix" "1" "$reads_config" |
83 | | - |
84 | | -# --------------------------------------------------------------------------- |
85 | | -# Test 5: Script falls back to basename of REPO_ROOT |
86 | | -# --------------------------------------------------------------------------- |
87 | | -echo "Test 5: script has fallback derivation from basename of REPO_ROOT" |
88 | | -has_basename_fallback=0 |
89 | | -if [ -f "$PLUGIN_SCRIPT" ]; then |
90 | | - if grep -qE 'basename.*REPO_ROOT|REPO_ROOT.*basename' "$PLUGIN_SCRIPT" 2>/dev/null; then |
91 | | - has_basename_fallback=1 |
92 | | - fi |
93 | | -fi |
94 | | -assert_eq "test_fallback_uses_basename" "1" "$has_basename_fallback" |
95 | | - |
96 | | -# --------------------------------------------------------------------------- |
97 | | -# Test 6: Fallback derivation handles special chars (tr for lowercase/a-z0-9-) |
98 | | -# --------------------------------------------------------------------------- |
99 | | -echo "Test 6: fallback derivation handles dots, underscores, uppercase" |
100 | | -has_transform=0 |
101 | | -if [ -f "$PLUGIN_SCRIPT" ]; then |
102 | | - if grep -qE "tr.*\[\[:upper:\]\].*\[\[:lower:\]\]|tr.*'a-z0-9-'" "$PLUGIN_SCRIPT" 2>/dev/null; then |
103 | | - has_transform=1 |
104 | | - fi |
105 | | -fi |
106 | | -assert_eq "test_fallback_handles_special_chars" "1" "$has_transform" |
107 | | - |
108 | | -# --------------------------------------------------------------------------- |
109 | | -# Test 7: Script contains GATHER_COMPLETE section (smoke test of completeness) |
110 | | -# --------------------------------------------------------------------------- |
111 | | -echo "Test 7: script contains GATHER_COMPLETE section" |
112 | | -has_gather_complete=0 |
113 | | -if [ -f "$PLUGIN_SCRIPT" ]; then |
114 | | - grep -q 'GATHER_COMPLETE' "$PLUGIN_SCRIPT" && has_gather_complete=1 |
115 | | -fi |
116 | | -assert_eq "test_gather_complete_section_present" "1" "$has_gather_complete" |
117 | | - |
118 | | -# --------------------------------------------------------------------------- |
119 | | -# Test 8: ARTIFACT_PREFIX variable is used in the timeout log glob pattern |
120 | | -# --------------------------------------------------------------------------- |
121 | | -echo "Test 8: ARTIFACT_PREFIX variable used in glob pattern" |
122 | | -uses_prefix_var=0 |
123 | | -if [ -f "$PLUGIN_SCRIPT" ]; then |
124 | | - if grep -qE '\$\{?ARTIFACT_PREFIX\}?' "$PLUGIN_SCRIPT" 2>/dev/null; then |
125 | | - uses_prefix_var=1 |
126 | | - fi |
127 | | -fi |
128 | | -assert_eq "test_config_prefix_used_in_glob" "1" "$uses_prefix_var" |
129 | 78 |
|
130 | 79 | # --------------------------------------------------------------------------- |
131 | | -# Tests 9-11: Functional tests of the fallback derivation logic. |
| 80 | +# Tests 4-6: Functional tests of the fallback derivation logic. |
132 | 81 | # We inline the derivation from the script spec and verify edge cases. |
133 | 82 | # --------------------------------------------------------------------------- |
134 | 83 |
|
|
0 commit comments