remove %% prefix operator

See #632
closes #545
closes #510

this makes #651 higher priority
This commit is contained in:
Andrew Kelley
2018-01-09 00:07:01 -05:00
parent 98a95cc698
commit 3c094116aa
46 changed files with 550 additions and 641 deletions

View File

@@ -151,20 +151,20 @@ pub const Buffer = struct {
test "simple Buffer" {
const cstr = @import("cstr.zig");
var buf = %%Buffer.init(debug.global_allocator, "");
var buf = try Buffer.init(debug.global_allocator, "");
assert(buf.len() == 0);
%%buf.append("hello");
%%buf.appendByte(' ');
%%buf.append("world");
try buf.append("hello");
try buf.appendByte(' ');
try buf.append("world");
assert(buf.eql("hello world"));
assert(mem.eql(u8, cstr.toSliceConst(buf.toSliceConst().ptr), buf.toSliceConst()));
var buf2 = %%Buffer.initFromBuffer(&buf);
var buf2 = try Buffer.initFromBuffer(&buf);
assert(buf.eql(buf2.toSliceConst()));
assert(buf.startsWith("hell"));
assert(buf.endsWith("orld"));
%%buf2.resize(4);
try buf2.resize(4);
assert(buf.startsWith(buf2.toSliceConst()));
}