Skip to content

Commit

Permalink
add new tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jade Abraham <[email protected]>
  • Loading branch information
jabraham17 committed Dec 9, 2024
1 parent 6738fc8 commit 5c118dd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/chplcheck/Unused.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@ module Unused {
proc foo(Outer) {
Outer[1] = 2;
}

proc tup1((x, (y, z))) {
return (x, y, z);
}
proc tup2((x, y)) {
return x;
}
proc tup3(((x, z), y)) {
return y;
}
proc tup4((x, y)) {
return (1, 2);
}
}
5 changes: 5 additions & 0 deletions test/chplcheck/Unused.good
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ Unused.chpl:3: node violates rule UnusedLoopIndex
Unused.chpl:5: node violates rule UnusedLoopIndex
Unused.chpl:13: node violates rule UnusedLoopIndex
Unused.chpl:20: node violates rule UnusedLoopIndex
Unused.chpl:45: node violates rule UnusedFormal
Unused.chpl:48: node violates rule UnusedFormal
Unused.chpl:48: node violates rule UnusedFormal
Unused.chpl:51: node violates rule UnusedFormal
Unused.chpl:51: node violates rule UnusedFormal
6 changes: 6 additions & 0 deletions test/chplcheck/UnusedTupleUnpack.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ foreach (_, _) in zip(1..10, 1..10) {}
foreach (i, (_, _)) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach (_, (_, _)) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach ((_, _), _) in zip(foreach pair in zip(1..10, 1..10) do pair, 1..10) { i; }

proc foo((_,_)) { }
proc foo((_,x)) { return x; }
proc foo((x,_)) { return x; }
proc foo((_,(_,_))) { return x; }
proc foo(((_,_),x)) { return x; }
4 changes: 4 additions & 0 deletions test/chplcheck/UnusedTupleUnpack.good
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ UnusedTupleUnpack.chpl:5: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:5: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:6: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:6: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:8: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:11: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:11: node violates rule UnusedTupleUnpack
UnusedTupleUnpack.chpl:12: node violates rule UnusedTupleUnpack
[Success matching fixit for UnusedTupleUnpack]
6 changes: 6 additions & 0 deletions test/chplcheck/UnusedTupleUnpack.good-fixit
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ foreach zip(1..10, 1..10) {}
foreach (i, _) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach (_, _) in zip(1..10, foreach pair in zip(1..10, 1..10) do pair) { i; }
foreach (_, _) in zip(foreach pair in zip(1..10, 1..10) do pair, 1..10) { i; }

proc foo((_,_)) { }
proc foo((_,x)) { return x; }
proc foo((x,_)) { return x; }
proc foo((_,_)) { return x; }
proc foo((_,x)) { return x; }

0 comments on commit 5c118dd

Please sign in to comment.