Skip to content

Commit

Permalink
Fixes type-file tests, which seem to have broken at some point in the…
Browse files Browse the repository at this point in the history
… past 11 months

Previously, fails on macOS:

```
 not ok 173 file install: if compiled, uses stored variable
 # (in test file test/type-file.bats, line 150)
 #   `borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(base64 Readme.md)"' failed with status 64
 # base64: invalid argument Readme.md
 # Usage:	base64 [-Ddh] [-b num] [-i in_file] [-o out_file]
 #   -b, --break    break encoded string into num character lines
 #   -Dd, --decode   decodes input
 #   -h, --help     display this message
 #   -i, --input    input file (default: "-" for stdin)
 #   -o, --output   output file (default: "-" for stdout)
```

(although, why it worked fine 11 months ago, i have no idea)

New syntax for the base64 part of the test should work the same on both
Darwin and Linux
  • Loading branch information
lucymhdavies committed Dec 30, 2024
1 parent 64dc6f3 commit 75d4603
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/type-file.bats
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ setup () {
@test "file compile: echoes base64 representation to screen" {
run file compile path/to/target Readme.md
[ "$status" -eq 0 ]
expected="borkfiles__UmVhZG1lLm1kCg=\"$(base64 Readme.md)\""
expected="borkfiles__UmVhZG1lLm1kCg=\"$(cat Readme.md | base64)\""
accum="${lines[2]}"
line=2
while [ "$line" -lt ${#lines[*]} ]; do
Expand All @@ -139,15 +139,15 @@ is_compiled () { [ -n "$is_compiled" ]; }

@test "file status: if compiled, uses stored variable" {
is_compiled=1
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(base64 Readme.md)"
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(cat Readme.md | base64)"
respond_to "$(md5cmd $platform path/to/target)" "echo $readsum"
run file status path/to/target path/from/source
[ "$status" -eq $STATUS_OK ]
}

@test "file install: if compiled, uses stored variable" {
is_compiled=1
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(base64 Readme.md)"
borkfiles__cGF0aC9mcm9tL3NvdXJjZQo="$(cat Readme.md | base64)"
run file install path/to/target path/from/source
[ "$status" -eq $STATUS_OK ]
run baked_output
Expand Down

0 comments on commit 75d4603

Please sign in to comment.