1.1 --- a/test/harness/testcaseinput.c Mon Feb 20 08:13:47 2012 +0000
1.2 +++ b/test/harness/testcaseinput.c Wed Oct 02 09:14:33 2013 +0100
1.3 @@ -32,10 +32,10 @@
1.4 }
1.5
1.6 /*
1.7 - * Replace \n with \r\n, U+240A (visible symbol for LF) with \n
1.8 - * and U+240D (visible symbol for CR) with \r.
1.9 + * Replace \n with requested newline, U+240A (visible symbol for LF)
1.10 + * with \n and U+240D (visible symbol for CR) with \r.
1.11 */
1.12 -static char *unix2dos(const char *text)
1.13 +static char *convert_newlines(const char *text,int flags)
1.14 {
1.15 gunichar c;
1.16 const gunichar visible_lf=0x240A;
1.17 @@ -46,8 +46,13 @@
1.18 {
1.19 c=g_utf8_get_char(text);
1.20 text=g_utf8_next_char(text);
1.21 - if (c=='\n')
1.22 - g_string_append(string,"\r\n");
1.23 + if (c=='\n' && !(flags&TESTCASE_UNIX_NEWLINES))
1.24 + {
1.25 + if (flags&TESTCASE_OS9_NEWLINES)
1.26 + g_string_append_c(string,'\r');
1.27 + else
1.28 + g_string_append(string,"\r\n");
1.29 + }
1.30 else if (c==visible_lf)
1.31 g_string_append_c(string,'\n');
1.32 else if (c==visible_cr)
1.33 @@ -76,7 +81,7 @@
1.34 {
1.35 if (testcase->encoding)
1.36 {
1.37 - t=unix2dos(input->contents);
1.38 + t=convert_newlines(input->contents,testcase->flags);
1.39 s=g_convert(t,-1,testcase->encoding,"UTF-8",NULL,&n,&tmp_err);
1.40 g_free(t);
1.41 if (!s)
1.42 @@ -88,7 +93,7 @@
1.43 }
1.44 else
1.45 {
1.46 - s=unix2dos(input->contents);
1.47 + s=convert_newlines(input->contents,testcase->flags);
1.48 n=strlen(s);
1.49 }
1.50 }