aboutsummaryrefslogtreecommitdiff
path: root/std/cstr.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-09-28 02:33:32 -0400
committerAndrew Kelley <superjoe30@gmail.com>2016-09-28 02:33:32 -0400
commitb581da41f82cd1e19701030bf47675b426608adf (patch)
treebbfebb52858935e2e91ffabd8b0c2b02fb58ca27 /std/cstr.zig
parente5fd8efcb60cd0223a7dd5e5825d3b9efc006c2a (diff)
downloadzig-b581da41f82cd1e19701030bf47675b426608adf.tar.gz
zig-b581da41f82cd1e19701030bf47675b426608adf.zip
remove compiler directives
* add `setFnTest`, `setFnVisible`, `setFnStaticEval`, `setFnNoInline` builtin functions to replace previous directive functionality * add `coldcc` and `nakedcc` as keywords which can be used as part of a function prototype. * `setDebugSafety` builtin can be used to set debug safety features at a per block scope level. * closes #169
Diffstat (limited to 'std/cstr.zig')
-rw-r--r--std/cstr.zig9
1 files changed, 6 insertions, 3 deletions
diff --git a/std/cstr.zig b/std/cstr.zig
index e5035aec4b..afe8d5b404 100644
--- a/std/cstr.zig
+++ b/std/cstr.zig
@@ -126,8 +126,9 @@ pub struct CBuf {
}
}
-#attribute("test")
fn testSimpleCBuf() {
+ @setFnTest(this, true);
+
var buf = %%CBuf.initEmpty(&debug.global_allocator);
assert(buf.len() == 0);
%%buf.appendCStr(c"hello");
@@ -146,12 +147,14 @@ fn testSimpleCBuf() {
assert(buf.startsWithCBuf(&buf2));
}
-#attribute("test")
fn testCompileTimeStrCmp() {
+ @setFnTest(this, true);
+
assert(@constEval(cmp(c"aoeu", c"aoez") == -1));
}
-#attribute("test")
fn testCompileTimeStrLen() {
+ @setFnTest(this, true);
+
assert(@constEval(len(c"123456789") == 9));
}