From 28055028a709020ba7eb44f9e5037d0a952b51d6 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 4 Jan 2010 20:49:58 +0100 Subject: fold: unicode support. Based on a patch by Tomas Heinrich General Unicode support is tweaked to expose unicode_status. function old new delta init_unicode - 77 +77 write2stdout - 19 +19 adjust_column 68 71 +3 unicode_status - 1 +1 unicode_is_enabled 1 - -1 grep_main 780 773 -7 fold_main 619 552 -67 check_unicode_in_env 77 - -77 ------------------------------------------------------------------------------ (add/remove: 3/2 grow/shrink: 1/2 up/down: 100/-152) Total: -52 bytes Signed-off-by: Denys Vlasenko --- testsuite/fold.tests | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) (limited to 'testsuite/fold.tests') diff --git a/testsuite/fold.tests b/testsuite/fold.tests index ca0e511c1..17721a180 100755 --- a/testsuite/fold.tests +++ b/testsuite/fold.tests @@ -7,8 +7,53 @@ # testing "test name" "options" "expected result" "file input" "stdin" testing "fold -s" "fold -w 7 -s" \ - "123456\n\t\nasdf" \ + "123456\n\t\nasdf" \ + "" \ + "123456\tasdf" \ + +testing "fold -w1" "fold -w1" \ + "q\nq\n \nw\n \ne\ne\ne\n \nr\n \nt\nt\nt\nt\n \ny" \ + "" \ + "qq w eee r tttt y" \ + +testing "fold with NULs" "fold -sw22" \ + "\ +The NUL is here:>\0< \n\ +and another one is \n\ +here:>\0< - they must \n\ +be preserved +" \ + "" \ + "The NUL is here:>\0< and another one \ +is here:>\0< - they must be preserved +" \ + +# The text was taken from English and Ukrainian wikipedia pages +testing "fold -sw66 with unicode input" "fold -sw66" \ + "\ +The Andromeda Galaxy (pronounced /ænˈdrɒmədə/, also known as \n\ +Messier 31, M31, or NGC224; often referred to as the Great \n\ +Andromeda Nebula in older texts) is a spiral galaxy approximately \n\ +2,500,000 light-years (1.58×10^11 AU) away in the constellation \n\ +Andromeda. It is the nearest spiral galaxy to our own, the Milky \n\ +Way.\n\ +Галактика або Туманність Андромеди (також відома як M31 за \n\ +каталогом Мессьє та NGC224 за Новим загальним каталогом) — \n\ +спіральна галактика, що знаходиться на відстані приблизно у 2,5 \n\ +мільйони світлових років від нашої планети у сузір'ї Андромеди. \n\ +На початку ХХІ ст. в центрі галактики виявлено чорну дірку." \ "" \ - "123456\tasdf" \ + "\ +The Andromeda Galaxy (pronounced /ænˈdrɒmədə/, also known as \ +Messier 31, M31, or NGC224; often referred to as the Great \ +Andromeda Nebula in older texts) is a spiral galaxy approximately \ +2,500,000 light-years (1.58×10^11 AU) away in the constellation \ +Andromeda. It is the nearest spiral galaxy to our own, the Milky \ +Way. +Галактика або Туманність Андромеди (також відома як M31 за \ +каталогом Мессьє та NGC224 за Новим загальним каталогом) — \ +спіральна галактика, що знаходиться на відстані приблизно у 2,5 \ +мільйони світлових років від нашої планети у сузір'ї Андромеди. \ +На початку ХХІ ст. в центрі галактики виявлено чорну дірку." \ exit $FAILCOUNT -- cgit v1.2.3