File: string-file.5c

package info (click to toggle)
nickle 2.107
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 3,756 kB
  • sloc: ansic: 27,954; yacc: 1,874; lex: 954; sh: 204; makefile: 13; lisp: 1
file content (20 lines) | stat: -rw-r--r-- 353 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Nickle test suite
 *
 * string I/O tests
 */

exception bad_result (poly want, poly got);

void check(poly want, poly got)
{
    if (want != got)
	raise bad_result(want, got);
}

check("", File::string_string(File::string_write()));

file f = File::string_write();
File::fprintf(f, "hello, world");
check("hello, world", File::string_string(f));