diff -r 51a0beae92f6 -r 2d48e8cdda24 test/harness/testcaseinput.c --- a/test/harness/testcaseinput.c Mon Feb 20 08:13:47 2012 +0000 +++ b/test/harness/testcaseinput.c Wed Oct 02 09:14:33 2013 +0100 @@ -32,10 +32,10 @@ } /* - * Replace \n with \r\n, U+240A (visible symbol for LF) with \n - * and U+240D (visible symbol for CR) with \r. + * Replace \n with requested newline, U+240A (visible symbol for LF) + * with \n and U+240D (visible symbol for CR) with \r. */ -static char *unix2dos(const char *text) +static char *convert_newlines(const char *text,int flags) { gunichar c; const gunichar visible_lf=0x240A; @@ -46,8 +46,13 @@ { c=g_utf8_get_char(text); text=g_utf8_next_char(text); - if (c=='\n') - g_string_append(string,"\r\n"); + if (c=='\n' && !(flags&TESTCASE_UNIX_NEWLINES)) + { + if (flags&TESTCASE_OS9_NEWLINES) + g_string_append_c(string,'\r'); + else + g_string_append(string,"\r\n"); + } else if (c==visible_lf) g_string_append_c(string,'\n'); else if (c==visible_cr) @@ -76,7 +81,7 @@ { if (testcase->encoding) { - t=unix2dos(input->contents); + t=convert_newlines(input->contents,testcase->flags); s=g_convert(t,-1,testcase->encoding,"UTF-8",NULL,&n,&tmp_err); g_free(t); if (!s) @@ -88,7 +93,7 @@ } else { - s=unix2dos(input->contents); + s=convert_newlines(input->contents,testcase->flags); n=strlen(s); } }