Commit Graph

4 Commits

Author SHA1 Message Date
Zoltan Somogyi
d23c4f74a3 Update the style of more tests. 2020-10-06 19:20:18 +11:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Julien Fischer
fd822d712a Do not allow unterminated octal escapes in string literals.
library/lexer.m:
	Fix an old XXX: do not allow unterminated octal escapes in string
	literals; we haven't needed to preserve bug-for-bug compatibility
	with NU-Prolog for a very long time.

tests/hard_coded/special_char.m:
	Terminate octal escapes.

tests/invalid/Mmakefile:
tests/invalid/unterminated_octal_escape.{m,err_exp}:
	Check for an error if an unterminated octal escape is encountered.
2014-12-15 00:56:20 +11:00
Fergus Henderson
8c6f60daba Fix a bug where we were generating C code that contained special
Estimated hours taken: 2
Branches: main

Fix a bug where we were generating C code that contained special
characters in string literals.  This generated code was relying on
the implementation-specific behaviour of GCC, and unfortunately
that behaviour changed in GCC versions 2.96 and later.
The symptom was that printing "\r\n" came out as "\n\n"
when using GCC versions >= 2.96.

compiler/c_util.m:
	Change the code used to implement quote_char, quote_string,
	and quote_multi_string so that these routines properly escape
	all special characters, rather than just \" \' \n \b and \t.
	(This required changing the output argument type for quote_char
	from a character to a string.)
	Add output_quoted_char, for use by layout_out.m.

compiler/layout_out.m:
	Use c_util__output_quoted_char, rather than duplicating the
	logic in c_util.m.

tests/hard_coded/Mmakefile:
tests/hard_coded/special_char.m:
tests/hard_coded/special_char.exp:
	Regression test.

tests/hard_coded/Mmakefile:
tests/hard_coded/null_char.m:
tests/hard_coded/null_char.exp:
tests/hard_coded/null_char.exp2:
	Add a test of outputting strings containing null characters.
	Note that currently we don't handle this correctly;
	we ignore everything after the first null character.
	So the ".exp2" file for this test case allows that output.
	If/when this is fixed, the ".exp2" file for this
	test case should be removed.
2002-08-06 00:30:52 +00:00