summaryrefslogtreecommitdiff
path: root/libstd/test/strbuf.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
commit2bc852bda98762d3bc01548bf972e3f1b137fbfb (patch)
tree74831deed3c9057c5fe0cbb8790d220e855bc792 /libstd/test/strbuf.myr
parent3de952510eb2a23350d24ed926f19c0cf72a12f2 (diff)
downloadmc-2bc852bda98762d3bc01548bf972e3f1b137fbfb.tar.gz
Move Myrddin libs to lib/ subdirectory.
Diffstat (limited to 'libstd/test/strbuf.myr')
-rw-r--r--libstd/test/strbuf.myr40
1 files changed, 0 insertions, 40 deletions
diff --git a/libstd/test/strbuf.myr b/libstd/test/strbuf.myr
deleted file mode 100644
index 2643da5..0000000
--- a/libstd/test/strbuf.myr
+++ /dev/null
@@ -1,40 +0,0 @@
-use std
-
-const main = {
- var sb
- var buf : byte[16]
-
- sb = std.mksb()
- std.assert(std.sleq(std.sbpeek(sb), ""), "mismatched empty str\n")
- std.sbputs(sb, "hello")
- std.assert(std.sleq(std.sbpeek(sb), "hello"), "mismatched hello\n")
- std.sbputs(sb, ", hello")
- std.assert(std.sleq(std.sbpeek(sb), "hello, hello"), "mismatched double hello\n")
- std.sbtrim(sb, 7)
- std.assert(std.sleq(std.sbpeek(sb), "hello, "), "mismatched trim\n")
- std.sbputs(sb, "world")
- std.assert(std.sleq(std.sbpeek(sb), "hello, world"), "mismatched hello world\n")
- std.sbtrim(sb, -5)
- std.assert(std.sleq(std.sbpeek(sb), "hello, "), "mismatched rtrim\n")
- std.sbputc(sb, '世')
- std.sbputc(sb, '界')
- std.assert(std.sleq(std.sbpeek(sb), "hello, 世界"), "mismatched unicode\n")
- std.sbputb(sb, 10)
- std.assert(std.sleq(std.sbpeek(sb), "hello, 世界\n"), "mismatched byte\n")
-
- sb = std.mkbufsb(buf[:])
- std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 5 characters */
- std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 10 characters */
- std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 15 characters */
- std.assert(!std.sbputs(sb, "hello"), "erronous success\n") /* 16 characters */
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohelloh"), "failed to copy as much as possible\n")
- std.sbtrim(sb, -1)
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohello"), "failed rtrim\n")
- std.sbputc(sb, '世')
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohello"), "modified overflowed putc\n")
- std.sbtrim(sb, -2)
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohel"), "failed rtrim\n")
- std.sbputc(sb, '世')
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohel世"), "failed to append with putc\n")
-}
-