Re: [PATCH v3 34/39] t: add test_oid option to select hash algorithm
From: Eric Sunshine <hidden>
Date: 2020-07-23 04:51:47
On Wed, Jul 22, 2020 at 9:11 PM brian m. carlson [off-list ref] wrote:
In some tests, we have data files which are written with a particular hash algorithm. Instead of keeping two copies of the test files, we can keep one, and translate the value on the fly. In order to do so, we'll need to read both the source algorithm and the current algorithm, so add an optional flag to the test_oid helper that lets us read look up a value for a specified hash algorithm. This should
Readers trip over confusing grammar: "lets us read look up a value"
quoted hunk ↗ jump to hunk
not cause any conflicts with existing tests, since key arguments to test_oid are allowed to contains only shell identifier characters. Signed-off-by: brian m. carlson <redacted> ---diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh@@ -928,6 +928,17 @@ test_expect_success 'test_oid can look up data for SHA-256' ' +test_expect_success 'test_oid can look up data a specified algorithm' '
Readers trip over confusing grammar: "can look up data a specified".
quoted hunk ↗ jump to hunk
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh@@ -1468,7 +1468,17 @@ test_oid_cache () { # Look up a per-hash value based on a key ($1). The value must have been loaded # by test_oid_init or test_oid_cache. test_oid () {
Should the function documentation be updated to talk about the new --hash option?
quoted hunk ↗ jump to hunk
+ case "$1" in + --hash=*) + algo="${1#--hash=}" &&
Bikeshedding: I wonder if this should be named "--algo"?