migrate all the temporary tests to new test file

This commit is contained in:
Andrew Kelley
2016-12-22 00:12:27 -05:00
parent d544672ed4
commit 56cc2e2b24
9 changed files with 152 additions and 117 deletions

View File

@@ -18,8 +18,34 @@ fn errorWrapping() {
assert(%%baz() == 15);
}
error ItBroke;
fn gimmeItBroke() -> []const u8 {
@errorName(error.ItBroke)
}
fn errorName() {
@setFnTest(this);
assert(memeql(@errorName(error.ItBroke), "ItBroke"));
}
// TODO const assert = @import("std").debug.assert;
fn assert(ok: bool) {
if (!ok)
@unreachable();
}
// TODO import from std.str
pub fn memeql(a: []const u8, b: []const u8) -> bool {
sliceEql(u8, a, b)
}
// TODO import from std.str
pub fn sliceEql(inline T: type, a: []const T, b: []const T) -> bool {
if (a.len != b.len) return false;
for (a) |item, index| {
if (b[index] != item) return false;
}
return true;
}