<commit_before>#!/bin/sh
# vim:ft=sh:sw=8

. $(dirname $0)/../bshtap

(
cat << EOM
. $(dirname $0)/common.sh
. $(dirname $0)/../bshtap

EOM

cat << 'EOM'

diag output with diag
diag
diag # without args

diag foo	# one word
diag "foo"	# one quoted word
diag 'foo'	# another quoted word

diag foo bar 		# two word
diag "foo bar" 		# quoted two word
diag 'foo bar'
diag "foo" "bar" 	# two quoted word
diag 'foo' 'bar'

diag $(nword 3 foo) 	# with command substitution
diag "$(nword 3 foo)"
diag '$(nword 3 foo)' 	# should not be substituted

diag `nword 3 foo` 	# another command substitution
diag "`nword 3 foo`"
diag '`nword 3 foo`'

diag $(nline 3 foo) 	# command substitution with newlines
diag "$(nline 3 foo)"	# all lines should be started with '# '

diag output without test name
ok true
is "nword 1 foo" "foo"
isnt "nword 1 foo" "bar"
like "nword 1 foo" "^foo$"
unlike "nword 1 foo" "of"
cmp_ok true -eq 0

diag stdout will be commented out when ok / cmp_ok
ok "nword 1 foo"
cmp_ok "nword 1 foo" -eq 0

( skip_all )
( skip_all some reason )

echo
echo ALL_DONE

EOM
) |sh - > output.out

tests 1
ok "diff -q output.out $(dirname $0)/output.ref" "output check"<commit_msg>t/output.t: Drop echo and modify to use printf instead<commit_after>#!/bin/sh
# vim:ft=sh:sw=8

. $(dirname $0)/../bshtap

(
cat << EOM
. $(dirname $0)/common.sh
. $(dirname $0)/../bshtap

EOM

cat << 'EOM'

diag output with diag
diag
diag # without args

diag foo	# one word
diag "foo"	# one quoted word
diag 'foo'	# another quoted word

diag foo bar 		# two word
diag "foo bar" 		# quoted two word
diag 'foo bar'
diag "foo" "bar" 	# two quoted word
diag 'foo' 'bar'

diag $(nword 3 foo) 	# with command substitution
diag "$(nword 3 foo)"
diag '$(nword 3 foo)' 	# should not be substituted

diag `nword 3 foo` 	# another command substitution
diag "`nword 3 foo`"
diag '`nword 3 foo`'

diag $(nline 3 foo) 	# command substitution with newlines
diag "$(nline 3 foo)"	# all lines should be started with '# '

diag output without test name
ok true
is "nword 1 foo" "foo"
isnt "nword 1 foo" "bar"
like "nword 1 foo" "^foo$"
unlike "nword 1 foo" "of"
cmp_ok true -eq 0

diag stdout will be commented out when ok / cmp_ok
ok "nword 1 foo"
cmp_ok "nword 1 foo" -eq 0

( skip_all )
( skip_all some reason )

printf "\nALL_DONE\n"

EOM
) |sh - > output.out

tests 1
ok "diff -q output.out $(dirname $0)/output.ref" "output check"
{'fraction_non_alphanumeric': 0.12979966611018365, 'fraction_numerical': 0.018363939899833055, 'mean_word_length': 3.5570342205323193, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6454144', 'n_tokens_mistral': 959, 'n_tokens_neox': 900, 'n_words': 366}