# HG changeset patch # User ali # Date 1329725627 0 # Node ID 51a0beae92f68f0262195f4a42c7a4e3e29e5171 # Parent 8744c913ccdd3da1af8a4c412eedfbaec3688ead Add testcase for embedded CRs diff -r 8744c913ccdd -r 51a0beae92f6 test/compatibility/Makefile.am --- a/test/compatibility/Makefile.am Sun Feb 19 23:14:54 2012 +0000 +++ b/test/compatibility/Makefile.am Mon Feb 20 08:13:47 2012 +0000 @@ -7,6 +7,6 @@ dashes.tst control-characters.tst unusual-characters.tst \ windows-1252.tst periods.tst long-line.tst unmarked-paragraph.tst \ hebe-jeebies.tst mail-from.tst scannos.tst before-comma.tst \ - before-period.tst double-punctuation.tst genatives.tst + before-period.tst double-punctuation.tst genatives.tst embedded-cr.tst dist_pkgdata_DATA=$(TESTS) diff -r 8744c913ccdd -r 51a0beae92f6 test/compatibility/embedded-cr.tst --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compatibility/embedded-cr.tst Mon Feb 20 08:13:47 2012 +0000 @@ -0,0 +1,11 @@ +**************** INPUT **************** +The return to Cedarville was a great event. Dora clasped her mother in␍ +her arms and laughed and wept by turns, and then threw herself into +Dick's␍embrace. +**************** EXPECTED **************** + +The return to Cedarville was a great event. Dora clasped her mother in + Line 1 - Two successive CRs? + +Dick's + Line 3 column 7 - CR without LF? diff -r 8744c913ccdd -r 51a0beae92f6 test/harness/testcaseinput.c --- a/test/harness/testcaseinput.c Sun Feb 19 23:14:54 2012 +0000 +++ b/test/harness/testcaseinput.c Mon Feb 20 08:13:47 2012 +0000 @@ -32,12 +32,14 @@ } /* - * Replace \n with \r\n and U+240A (visible symbol for LF) with \n + * Replace \n with \r\n, U+240A (visible symbol for LF) with \n + * and U+240D (visible symbol for CR) with \r. */ static char *unix2dos(const char *text) { gunichar c; const gunichar visible_lf=0x240A; + const gunichar visible_cr=0x240D; GString *string; string=g_string_new(NULL); while(*text) @@ -48,6 +50,8 @@ g_string_append(string,"\r\n"); else if (c==visible_lf) g_string_append_c(string,'\n'); + else if (c==visible_cr) + g_string_append_c(string,'\r'); else g_string_append_unichar(string,c); }