From 4f8c2c8ba268b80f4d9d18372ae45e044200ae52 Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Sat, 22 Apr 2017 14:09:56 -0400 Subject: [PATCH] tests: convert "8bit" test to new framework The input (8bit.inp) and expected output (8bit.good) contains non-ascii octets, and are kept as-is. The sed program is converted to newer init.sh-style tests. * testsuite/8bit.sed: Removed. * testsuite/8bit.sh: New test. * testsuite/local.mk (EXTRA_DIST): Remove 8bit.sed. (SEDTEST) Remove 8bit.sed. (T): Add 8bit.sh. --- testsuite/8bit.sed | 21 ----------------- testsuite/8bit.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++ testsuite/local.mk | 5 ++-- 3 files changed, 60 insertions(+), 23 deletions(-) delete mode 100644 testsuite/8bit.sed create mode 100755 testsuite/8bit.sh diff --git a/testsuite/8bit.sed b/testsuite/8bit.sed deleted file mode 100644 index 37c0624..0000000 --- a/testsuite/8bit.sed +++ /dev/null @@ -1,21 +0,0 @@ -# The first poem from the Man'yoshu. I like Hitomaro's poems better -# but I couldn't find a copy of any of them in Japanese. This version -# of this poem is from $BNc2r8E8l<-E5(B($BBh;0HG(B)$B;0>JF2(B. -# -# Speaking of Hitomaro, here is the english translation of one of my -# favorites. I just know that everyone reading these test cases wants -# to see this. -# -# In the autumn mountains -# The yellow leaves are so thick. -# Alas, how shall I seek my love -# Who has wandered away? -# -# I see the messenger come -# As the yellow leaves are falling. -# Oh, well I remember -# How on such a day we used to meet-- -# My lover and I! -# -- Kakinomoto Hitomaro -# -s/大和/日本/ diff --git a/testsuite/8bit.sh b/testsuite/8bit.sh new file mode 100755 index 0000000..b150cdf --- /dev/null +++ b/testsuite/8bit.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +# Adapted from sed's old "8bit" test + +# Copyright (C) 2017 Free Software Foundation, Inc. + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +. "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed +print_ver_ sed + +fail=0 + +# Original comment from '8bit.sed': + +# The first poem from the Man'yoshu. I like Hitomaro's poems better +# but I couldn't find a copy of any of them in Japanese. This version +# of this poem is from $BNc2r8E8l<-E5(B($BBh;0HG(B)$B;0>JF2(B. +# +# Speaking of Hitomaro, here is the english translation of one of my +# favorites. I just know that everyone reading these test cases wants +# to see this. +# +# In the autumn mountains +# The yellow leaves are so thick. +# Alas, how shall I seek my love +# Who has wandered away? +# +# I see the messenger come +# As the yellow leaves are falling. +# Oh, well I remember +# How on such a day we used to meet-- +# My lover and I! +# -- Kakinomoto Hitomaro + +# The program is: +# s/大和/日本/ +printf "s/\302\347\317\302/\306\374\313\334/\n" > 8bit-prog.sed \ + || framework_failure_ + + +sed -f 8bit-prog.sed < "$abs_top_srcdir/testsuite/8bit.inp" > out || fail=1 +remove_cr_inplace out +compare "$abs_top_srcdir/testsuite/8bit.good" out || fail=1 + + +Exit $fail diff --git a/testsuite/local.mk b/testsuite/local.mk index 77131b2..8af9a5e 100644 --- a/testsuite/local.mk +++ b/testsuite/local.mk @@ -84,6 +84,8 @@ T += testsuite/follow-symlinks.sh \ testsuite/follow-symlinks-stdin.sh endif +# Old tests converted to newer init.sh style +T += testsuite/8bit.sh TESTS = $(check_PROGRAMS) $(SEDTESTS) $(T) @@ -106,7 +108,7 @@ check_PROGRAMS += testsuite/bug-regex7 \ testsuite/runptests testsuite/tst-rxspencer testsuite/tst-regex2 endif -SEDTESTS += testsuite/8bit testsuite/newjis \ +SEDTESTS += testsuite/newjis \ testsuite/noeolw \ testsuite/madding testsuite/mac-mf \ testsuite/xemacs \ @@ -185,7 +187,6 @@ EXTRA_DIST += \ testsuite/runtest testsuite/Makefile.tests \ testsuite/8bit.good \ testsuite/8bit.inp \ - testsuite/8bit.sed \ testsuite/8to7.good \ testsuite/8to7.inp \ testsuite/8to7.sed \