summaryrefslogtreecommitdiff
path: root/tests/assert-deps.sh
blob: e358abdfe4830f1ac5f7f0321f6df3ea0ccbd2ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
set -eu

if [ ! -e .git ]; then
	echo "Not in a Git repository, skipping \"$0\"." >&2
	exit
fi

. tools/lib.sh

F="$(mkstemp)"
trap 'rm -f "$F"' EXIT


awk '
	$0 == "sources.js = \\"  { sources = 1; next }
	$0 == "tests.js = \\"    { tests   = 1; next }
	sources == 1 && $0 == "" { sources = 2; next }
	tests   == 1 && $0 == "" { tests   = 2; next }

	sources == 1 || tests == 1 {
		print $1
	}

	END {
		if (sources != 2) {
			print "Could not find $(sources.js) in Makefile." \
				> "/dev/stderr"
			exit 2
		}
		if (tests != 2) {
			print "Could not find $(tests.js) in Makefile." \
				> "/dev/stderr"
			exit 2
		}
	}
' Makefile | LANG=POSIX.UTF-8 sort > "$F"

git ls-files src/*.js tests/js/*.js |
	LANG=POSIX.UTF-8 sort |
	diff -U10 "$F" -