#!/bin/bash . "$TF_DIR/include/subtest.sh" . "$TF_DIR/include/tools.sh" . "$(sfpath)" || tf_exit_error "failed to init shellfu" shellfu import inigrep || tf_exit_error "failed to import inigrep" tf_enum_subtests() { echo "both_keys_and_sections" echo "games_with_spaces" echo "keys_only" echo "keys_sections_spaces" # echo "plain" # FIXME: arguable # echo "plain_strict" # FIXME: arguable echo "sections_only" echo "tricks_with_strange_naming" echo "strict_and_space" echo "strict_and_tab" echo "inlinecmt_hash" echo "inlinecmt_sc" echo "inlinecmt_hash_and_strict" echo "inlinecmt_sc_and_strict" echo "list_keys" echo "list_paths" echo "list_sections" echo "list_tricky_all_keys" echo "list_tricky_all_paths" echo "list_tricky_all_sections" echo "list_tricky_s1_keys" } tf_do_subtest() { local name=$1 local t_in="test/$name.stdin" local o_out="oracle/$name.stdout" case $name in inlinecmt_*) t_in="test/inlinecmt.stdin" ;; esac local cmd case $name in both_keys_and_sections) cmd='inigrep section1.key1' ;; games_with_spaces) cmd='inigrep "maybe spaced.spaced key"' ;; keys_only) cmd='inigrep .key1' ;; keys_sections_spaces) cmd='inigrep section1.key1' ;; plain) cmd='inigrep .' ;; plain_strict) cmd='inigrep -r .' ;; sections_only) cmd='inigrep section2.' ;; tricks_with_strange_naming) cmd='inigrep "section with/ slash and spaces".' ;; strict_and_space) cmd='inigrep -r myscript.py' ;; strict_and_tab) cmd='inigrep -r my_script.py' ;; inlinecmt_hash) cmd='inigrep joe.score' ;; inlinecmt_sc) cmd='inigrep bob.score' ;; inlinecmt_hash_and_strict) cmd='inigrep -r joe.catchphrase' ;; inlinecmt_sc_and_strict) cmd='inigrep -r bob.catchphrase' ;; list_keys) cmd='inigrep -K ""' ;; list_paths) cmd='inigrep -P' ;; list_sections) cmd='inigrep -S' ;; list_tricky_all_keys) cmd='inigrep -K ""' ;; list_tricky_all_paths) cmd='inigrep -P' ;; list_tricky_all_sections) cmd='inigrep -S' ;; list_tricky_s1_keys) cmd='inigrep -K s1' ;; esac tf_testflt -n "$name" -i "$t_in" -O "$o_out" "$cmd" } tf_do_subtests