svn commit: r362017 - in head/usr.bin/sed: . tests

Yuri Pankov yuripv at yuripv.dev
Wed Jun 10 21:44:43 UTC 2020


Mateusz Piotrowski wrote:
> Author: 0mp (doc,ports committer)
> Date: Wed Jun 10 19:23:58 2020
> New Revision: 362017
> URL: https://svnweb.freebsd.org/changeset/base/362017
> 
> Log:
>    Read commands from stdin when -f - is passed to sed(1)
>    
>    This patch teaches sed to interpret a "-" in a special way when given
>    as an argument to the -f flag.
>    
>    This behavior is also present in GNU sed.
>    
>    PR:		244872
>    Tested by:	antoine (exp-run)
>    Reviewed by:	pfg, tobik (older version)
>    Approved by:	pfg (src)
>    Relnotes:	yes
>    MFC after:	2 weeks
>    Differential Revision:	https://reviews.freebsd.org/D24079
> 
> Modified:
>    head/usr.bin/sed/main.c
>    head/usr.bin/sed/sed.1
>    head/usr.bin/sed/tests/sed2_test.sh
[...]
> Modified: head/usr.bin/sed/tests/sed2_test.sh
> ==============================================================================
> --- head/usr.bin/sed/tests/sed2_test.sh	Wed Jun 10 18:59:46 2020	(r362016)
> +++ head/usr.bin/sed/tests/sed2_test.sh	Wed Jun 10 19:23:58 2020	(r362017)
> @@ -116,11 +116,68 @@ hex_subst_body()
>   	atf_check -o "inline:" sed 's/\xx//' d
>   }
>   
> +atf_test_case commands_on_stdin
> +commands_on_stdin_head()
> +{
> +	atf_set "descr" "Verify -f -"
> +}
> +commands_on_stdin_body()
> +{
> +	printf "a\n" > a
> +	printf "s/a/b/\n" > a_to_b
> +	printf "s/b/c/\n" > b_to_c
> +	printf "s/c/d/\n" > ./-
> +	atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
> +
> +	# Verify that nothing is printed if there are no input files provided.
> +	printf 'i\\\nx' > insert_x
> +	atf_check -o 'empty' sed -f - < insert_x
> +}
> +
> +atf_test_case commands_on_stdin
> +commands_on_stdin_head()
> +{
> +	atf_set "descr" "Verify -f -"
> +}
> +commands_on_stdin_body()
> +{
> +	printf "a\n" > a
> +	printf "s/a/b/\n" > a_to_b
> +	printf "s/b/c/\n" > b_to_c
> +	printf "s/c/d/\n" > ./-
> +	atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
> +
> +	# Verify that nothing is printed if there are no input files provided.
> +	printf 'i\\\nx' > insert_x
> +	atf_check -o 'empty' sed -f - < insert_x
> +}
> +
> +atf_test_case commands_on_stdin
> +commands_on_stdin_head()
> +{
> +	atf_set "descr" "Verify -f -"
> +}
> +commands_on_stdin_body()
> +{
> +	printf "a\n" > a
> +	printf "s/a/b/\n" > a_to_b
> +	printf "s/b/c/\n" > b_to_c
> +	printf "s/c/d/\n" > ./-
> +	atf_check -o 'inline:d\n' sed -f a_to_b -f - -f ./- a < b_to_c
> +
> +	# Verify that nothing is printed if there are no input files provided.
> +	printf 'i\\\nx' > insert_x
> +	atf_check -o 'empty' sed -f - < insert_x
> +}
> +
>   atf_init_test_cases()
>   {
>   	atf_add_test_case inplace_command_q
>   	atf_add_test_case inplace_hardlink_src
>   	atf_add_test_case inplace_symlink_src
>   	atf_add_test_case escape_subst
> +	atf_add_test_case commands_on_stdin
> +	atf_add_test_case commands_on_stdin
> +	atf_add_test_case commands_on_stdin
>   	atf_add_test_case hex_subst
>   }
> 

Am I reading it wrong, or is it the same test case added 3 times?


More information about the svn-src-all mailing list