Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/diff/tests/diff_test.sh
| Show All 18 Lines | |||||
| atf_test_case label | atf_test_case label | ||||
| atf_test_case report_identical | atf_test_case report_identical | ||||
| atf_test_case non_regular_file | atf_test_case non_regular_file | ||||
| atf_test_case binary | atf_test_case binary | ||||
| atf_test_case functionname | atf_test_case functionname | ||||
| atf_test_case noderef | atf_test_case noderef | ||||
| atf_test_case ignorecase | atf_test_case ignorecase | ||||
| atf_test_case dirloop | atf_test_case dirloop | ||||
| atf_test_case bigc | atf_test_case crange | ||||
| atf_test_case bigu | atf_test_case urange | ||||
| atf_test_case prleak | atf_test_case prleak | ||||
| atf_test_case same | atf_test_case same | ||||
| simple_body() | simple_body() | ||||
| { | { | ||||
| atf_check -o file:$(atf_get_srcdir)/simple.out -s eq:1 \ | atf_check -o file:$(atf_get_srcdir)/simple.out -s eq:1 \ | ||||
| diff "$(atf_get_srcdir)/input1.in" "$(atf_get_srcdir)/input2.in" | diff "$(atf_get_srcdir)/input1.in" "$(atf_get_srcdir)/input2.in" | ||||
| ▲ Show 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | atf_check \ | ||||
| diff -r a b | diff -r a b | ||||
| atf_check rm [ab]/foo/bar/up | atf_check rm [ab]/foo/bar/up | ||||
| atf_check mkdir -p b/foo/bar | atf_check mkdir -p b/foo/bar | ||||
| atf_check ln -s foo a/baz | atf_check ln -s foo a/baz | ||||
| atf_check ln -s foo b/baz | atf_check ln -s foo b/baz | ||||
| atf_check diff -r a b | atf_check diff -r a b | ||||
| } | } | ||||
| bigc_head() | crange_head() | ||||
| { | { | ||||
| atf_set "descr" "Context diff with very large context" | atf_set "descr" "Context diff context length range" | ||||
| } | } | ||||
| bigc_body() | crange_body() | ||||
| { | { | ||||
| echo $'x\na\ny' >a | echo $'x\nx\na\ny\ny' >a | ||||
| echo $'x\nb\ny' >b | echo $'x\nx\nb\ny\ny' >b | ||||
| atf_check -s exit:2 -e ignore diff -C$(((1<<31)-1)) a b | atf_check -s exit:2 -e match:'too small' \ | ||||
| atf_check -s exit:1 -o match:'--- 1,3 ---' \ | diff -C-1 a b | ||||
| diff -C$(((1<<31)-2)) a b | atf_check -s exit:2 -e match:'too small' \ | ||||
| atf_check -s exit:1 -o match:'--- 1,3 ---' \ | diff -C0 a b | ||||
| diff -Astone -C$(((1<<31)-2)) a b | atf_check -s exit:1 -o match:'--- 2,4 ---' \ | ||||
| diff -C1 a b | |||||
| atf_check -s exit:1 -o match:'--- 2,4 ---' \ | |||||
| diff -Astone -C1 a b | |||||
| atf_check -s exit:2 -e match:'too large' \ | |||||
| diff -C$((1<<31)) a b | |||||
| atf_check -s exit:1 -o match:'--- 1,5 ---' \ | |||||
| diff -C$(((1<<31)-1)) a b | |||||
| atf_check -s exit:1 -o match:'--- 1,5 ---' \ | |||||
| diff -Astone -C$(((1<<31)-1)) a b | |||||
| } | } | ||||
| bigu_head() | urange_head() | ||||
| { | { | ||||
| atf_set "descr" "Unified diff with very large context" | atf_set "descr" "Unified diff context length range" | ||||
| } | } | ||||
| bigu_body() | urange_body() | ||||
| { | { | ||||
| echo $'x\na\ny' >a | echo $'x\nx\na\ny\ny' >a | ||||
| echo $'x\nb\ny' >b | echo $'x\nx\nb\ny\ny' >b | ||||
| atf_check -s exit:2 -e ignore diff -U$(((1<<31)-1)) a b | atf_check -s exit:2 -e match:'too small' \ | ||||
| atf_check -s exit:1 -o match:'^@@ -1,3 \+1,3 @@$' \ | diff -U-1 a b | ||||
| diff -U$(((1<<31)-2)) a b | atf_check -s exit:1 -o match:'^@@ -3 \+3 @@$' \ | ||||
| atf_check -s exit:1 -o match:'^@@ -1,3 \+1,3 @@$' \ | diff -U0 a b | ||||
| diff -Astone -U$(((1<<31)-2)) a b | atf_check -s exit:2 -e match:'too large' \ | ||||
| diff -U$((1<<31)) a b | |||||
| atf_check -s exit:1 -o match:'^@@ -1,5 \+1,5 @@$' \ | |||||
| diff -U$(((1<<31)-1)) a b | |||||
| atf_check -s exit:1 -o match:'^@@ -1,5 \+1,5 @@$' \ | |||||
| diff -Astone -U$(((1<<31)-1)) a b | |||||
| } | } | ||||
| prleak_head() | prleak_head() | ||||
| { | { | ||||
| atf_set "descr" "Verify that pagination does not leak resources" | atf_set "descr" "Verify that pagination does not leak resources" | ||||
| } | } | ||||
| prleak_body() | prleak_body() | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | atf_init_test_cases() | ||||
| atf_add_test_case label | atf_add_test_case label | ||||
| atf_add_test_case report_identical | atf_add_test_case report_identical | ||||
| atf_add_test_case non_regular_file | atf_add_test_case non_regular_file | ||||
| atf_add_test_case binary | atf_add_test_case binary | ||||
| atf_add_test_case functionname | atf_add_test_case functionname | ||||
| atf_add_test_case noderef | atf_add_test_case noderef | ||||
| atf_add_test_case ignorecase | atf_add_test_case ignorecase | ||||
| atf_add_test_case dirloop | atf_add_test_case dirloop | ||||
| atf_add_test_case bigc | atf_add_test_case crange | ||||
| atf_add_test_case bigu | atf_add_test_case urange | ||||
| atf_add_test_case prleak | atf_add_test_case prleak | ||||
| atf_add_test_case same | atf_add_test_case same | ||||
| } | } | ||||