Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2020 00:44:38 +0300
From:      Yuri Pankov <yuripv@yuripv.dev>
To:        Mateusz Piotrowski <0mp@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r362017 - in head/usr.bin/sed: . tests
Message-ID:  <a5e45631-bf32-56bc-4c03-0d0ad1d10ff2@yuripv.dev>
In-Reply-To: <202006101923.05AJNwPt006602@repo.freebsd.org>
References:  <202006101923.05AJNwPt006602@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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?



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?a5e45631-bf32-56bc-4c03-0d0ad1d10ff2>