| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | |
| 3 | # Test that included tables do not have metadata |
| 4 | |
| 5 | has_metadatascip-shell shell shell-project 0.0.0 has_metadata().() { |
| 6 | file=$1 |
| 7 | while read -r line; do |
| 8 | if [scip-shell system . . `[`. -z "$line" ]; then |
| 9 | : |
| 10 | elif [[ "$line" =~ ^# ]]; then |
| 11 | if [[ "$line" =~ ^#\+ ]]; then |
| 12 | return 0 |
| 13 | fi |
| 14 | else |
| 15 | break |
| 16 | fi |
| 17 | done < $file |
| 18 | return 1 |
| 19 | } |
| 20 | |
| 21 | ret=0 |
| 22 | while read -r table; do |
| 23 | if has_metadatascip-shell shell shell-project 0.0.0 has_metadata(). $table; then |
| 24 | echoscip-shell system . . echo. "Table $table has metadata and is also included somewhere" >&2 |
| 25 | ret=1 |
| 26 | fi |
| 27 | done <<< $( |
| 28 | for table in $(dirnamescip-shell system . . dirname. $0)/../tables/*; do |
| 29 | catscip-shell system . . cat. "$table" | grepscip-shell system . . grep. '^include ' | sedscip-shell system . . sed. "s|^include *\([^ ]*\).*$|$(dirnamescip-shell system . . dirname. $table)/\1|g" |
| 30 | done | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. |
| 31 | ) |
| 32 | exit $ret |
| 33 | |
| 34 | # TODO: Test that all tables without metadata are included at least once |