File tree Expand file tree Collapse file tree 3 files changed +56
-1
lines changed
Expand file tree Collapse file tree 3 files changed +56
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Bats
2+ on :
3+ push :
4+ branches : [ master ]
5+ pull_request :
6+ branches : [ master ]
7+
8+ jobs :
9+ unit-test :
10+ runs-on : ubuntu-latest
11+ name : Bats
12+ steps :
13+ - uses : actions/checkout@v2
14+
15+ - name : install bats
16+ run : |
17+ git clone --depth=1 https://github.com/sstephenson/bats.git
18+
19+ - name : run tests
20+ run : bats/bin/bats ./tests.bat
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ exec 1>&2
2323git diff --cached --name-only --diff-filter=A -z $against -- " $ASSETS_DIR " | while read -d $' \0' f; do
2424 ext=" ${f##* .} "
2525 base=" ${f% .* } "
26+ filename=" $( basename " $f " ) "
2627
2728if [ " $ext " = " meta" ]; then
2829if [ $( git ls-files --cached -- " $base " | wc -l) = 0 ]; then
@@ -35,7 +36,7 @@ Please add \`$base' to git as well.
3536EOF
3637exit 1
3738fi
38- else
39+ elif [ " ${filename ## . * } " != ' ' ] ; then
3940 p=" $f "
4041while [ " $p " != " $ASSETS_DIR " ]; do
4142if [ $( git ls-files --cached -- " $p .meta" | wc -l) = 0 ]; then
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env bats
2+
3+ PRE_COMMIT=" $BATS_TEST_DIRNAME/scripts/pre-commit"
4+
5+ setup(){
6+ git init repo >& 2
7+ cd repo
8+ mkdir Assets
9+ }
10+
11+ teardown(){
12+ cd ..
13+ rm -rf repo
14+ }
15+
16+ @ test " ensuring .meta is commit" {
17+ touch Assets/assets
18+ git add Assets/assets
19+ run " $PRE_COMMIT"
20+ [ " $status" -eq 1 ]
21+ [ " ${lines[0]}" = " Error: Missing meta file." ]
22+
23+ touch Assets/assets.meta
24+ git add Assets/assets.meta
25+ run " $PRE_COMMIT"
26+ [ " $status" -eq 0 ]
27+ }
28+
29+ @ test " ignoring assets file which starts with dot" {
30+ touch Assets/.assets
31+ git add --force Assets/.assets
32+ run " $PRE_COMMIT"
33+ [ " $status" -eq 0 ]
34+ }
You can’t perform that action at this time.
0 commit comments