Something went wrong. Try again.
infra stuff in gleam
gleam atproto lexicon codegen oauth
Something went wrong. Try again.
1.4 kB · 40 lines
Shell
at main
1234567891011121314151617181920212223242526272829303132333435363738394041#!/usr/bin/env bash# Table-driven cases for depcheck.sh range rules, run against a scratch tree.set -euhere="$(cd "${BASH_SOURCE[0]%/*}" && pwd)"tmp="$(mktemp -d)"trap 'rm -r "${tmp:?}"' EXITmkdir "$tmp/scripts" "$tmp/a" "$tmp/b"cp "$here/depcheck.sh" "$tmp/scripts/"printf 'name = "atproto_x"\n[dependencies]\n' >"$tmp/b/gleam.toml"
cases=( "pass|>= 0.2.0 and < 0.3.0" "pass|>= 0.1.1 and < 0.3.0" "pass|>= 0.1.1 and < 0.2.0 or >= 0.2.0 and < 0.3.0" "pass|>= 1.2.0 and < 2.0.0" "pass|>= 1.2.0 and < 1.5.0" "fail|>= 0.2.0 and < 1.0.0" "fail|>= 0.2.0" "fail|>= 0.2.1 and < 0.2.5" "fail|>= 0.2.0 and < 0.3.1" "fail|>= 0.2.0 and < 0.2.0" "fail|>= 0.2.0 and < 0.1.0" "fail|>= 1.2.0 and < 3.0.0" "fail|>= 1.2.0 and < 1.2.0" "fail|~> 0.2")bad=0for c in "${cases[@]}"; do want="${c%%|*}" req="${c#*|}" printf 'name = "a"\n[dependencies]\natproto_x = "%s"\n' "$req" >"$tmp/a/gleam.toml" bash "$tmp/scripts/depcheck.sh" >/dev/null 2>&1 && got=pass || got=fail [[ "$got" == "$want" ]] || { echo "depcheck_test: '$req' wanted $want, got $got" >&2; bad=1; }done
printf 'name = "a"\n[dependencies]\natproto_x = { path = "../b" }\n' >"$tmp/a/gleam.toml"bash "$tmp/scripts/depcheck.sh" >/dev/null 2>&1 && { echo "depcheck_test: path dep passed" >&2; bad=1; }
((bad == 0)) && echo "depcheck_test: ok (${#cases[@]} range cases + path dep)"exit "$bad"