interplane.Get Omega
Read in your language

git

[Ported from github.com/git/git] Sync with Git 2.56.1

Brought by drakestapleton

branch master Branches Tags History

git / t / chainlint / nested-loop-detect-failure.test

37 lines · 804 bytes Raw Blame History
1test_expect_success 'nested-loop-detect-failure' '
2# LINT: neither loop handles failure explicitly with "|| return 1"
3for i in 0 1 2 3 4 5 6 7 8 9;
4do
5 for j in 0 1 2 3 4 5 6 7 8 9;
6 do
7 echo "$i$j" >"path$i$j"
8 done
9done &&
10
11# LINT: inner loop handles failure explicitly with "|| return 1"
12for i in 0 1 2 3 4 5 6 7 8 9;
13do
14 for j in 0 1 2 3 4 5 6 7 8 9;
15 do
16 echo "$i$j" >"path$i$j" || return 1
17 done
18done &&
19
20# LINT: outer loop handles failure explicitly with "|| return 1"
21for i in 0 1 2 3 4 5 6 7 8 9;
22do
23 for j in 0 1 2 3 4 5 6 7 8 9;
24 do
25 echo "$i$j" >"path$i$j"
26 done || return 1
27done &&
28
29# LINT: inner & outer loops handles failure explicitly with "|| return 1"
30for i in 0 1 2 3 4 5 6 7 8 9;
31do
32 for j in 0 1 2 3 4 5 6 7 8 9;
33 do
34 echo "$i$j" >"path$i$j" || return 1
35 done || return 1
36done
37'