From: Derrick Stolee Date: Thu, 12 Jul 2018 18:06:08 GMT Subject: Re: [PATCH v3 07/24] multi-pack-index: expand test data Message-ID: <59cbce97-66cf-8332-c901-8a75f375b670@gmail.com> In-Reply-To: On 7/12/2018 2:02 PM, Eric Sunshine wrote: > On Thu, Jul 12, 2018 at 10:10 AM Derrick Stolee wrote: >> On 7/6/2018 12:36 AM, Eric Sunshine wrote: >>> There seems to be a fair bit of duplication in these tests which >>> create objects. Is it possible to factor out some of this code into a >>> shell function? >> In addition to the other small changes, this refactor in particular was >> a big change (but a good one). I'm sending my current progress in this >> direction, as I expect this can be improved. > I like the amount of code reduction. A couple minor comments... > >> +generate_objects () { >> + i=$1 >> + iii=$(printf '%03i' $i) >> + { >> + test-tool genrandom "bar" 200 && >> + test-tool genrandom "baz $iii" 50 >> + } >wide_delta_$iii && >> + { >> + test-tool genrandom "foo"$i 100 && >> + test-tool genrandom "foo"$(( $i + 1 )) 100 && >> + test-tool genrandom "foo"$(( $i + 2 )) 100 >> + } >>deep_delta_$iii && > I think this should be: s/>>/>/ It should! >> + echo $iii >file_$iii && >> + test-tool genrandom "$iii" 8192 >>file_$iii && > And this: s/>>/>/ In addition, I should wrap these two commands in { } like the files above. Thanks, -Stolee