Skip to content

Commit

Permalink
Merge pull request #443 from jwest115/issue-404-unit-tests
Browse files Browse the repository at this point in the history
Add unit test for duplicate file names
  • Loading branch information
bocchino authored Jun 10, 2024
2 parents b8788d6 + 61e31ef commit 9fd4653
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 3 deletions.
4 changes: 2 additions & 2 deletions compiler/tools/fpp-to-dict/test/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ run_test()
else
outfile=$infile
fi
$fpp_to_dict $args $infile.fpp 2>&1
$fpp_to_dict $args $infile.fpp 2>&1 | remove_author | remove_path_prefix > $outfile.out.txt
}

. ./tests.sh
Expand All @@ -31,7 +31,7 @@ do
echo "
$t()
{
run_test $t
run_test '' $t
}"
done > default-tests.sh
. ./default-tests.sh
Expand Down
2 changes: 1 addition & 1 deletion compiler/tools/fpp-to-dict/test/scripts/update-ref.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ update()
else
outfile=$infile
fi
$fpp_to_dict $args $infile.fpp 2>&1
$fpp_to_dict $args $infile.fpp 2>&1 | remove_path_prefix > $outfile.ref.txt
}

for file in `find . -name '*.ref.txt'`
Expand Down
Empty file.
8 changes: 8 additions & 0 deletions compiler/tools/fpp-to-dict/test/top/duplicate.fpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module M {

topology Duplicate {
}
}

topology Duplicate {
}
9 changes: 9 additions & 0 deletions compiler/tools/fpp-to-dict/test/top/duplicate.ref.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fpp-to-dict
[ local path prefix ]/tools/fpp-to-dict/test/top/duplicate.fpp:7.1
topology Duplicate {
^
error: duplicate JSON file DuplicateTopologyDictionary.json
previous file would be generated here:
[ local path prefix ]/tools/fpp-to-dict/test/top/duplicate.fpp:3.3
topology Duplicate {
^
Empty file.
6 changes: 6 additions & 0 deletions compiler/tools/fpp-to-dict/test/top/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ dataProducts()
run_test "-i builtin.fpp -p 1.0.0 -f 3.4.3" dataProducts && \
validate_json_schema BasicDp && \
diff_json BasicDp
}

duplicate()
{
run_test '' duplicate && \
compare duplicate
}
1 change: 1 addition & 0 deletions compiler/tools/fpp-to-dict/test/top/tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
tests="
multipleTops
dataProducts
duplicate
"

0 comments on commit 9fd4653

Please sign in to comment.