diff options
Diffstat (limited to 'tests/manyloc/standalone')
-rw-r--r-- | tests/manyloc/standalone/barebone.nim | 16 | ||||
-rw-r--r-- | tests/manyloc/standalone/barebone.nim.cfg | 2 | ||||
-rw-r--r-- | tests/manyloc/standalone/panicoverride.nim | 14 |
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/manyloc/standalone/barebone.nim b/tests/manyloc/standalone/barebone.nim new file mode 100644 index 000000000..487f6da65 --- /dev/null +++ b/tests/manyloc/standalone/barebone.nim @@ -0,0 +1,16 @@ +discard """ +ccodecheck: "\\i !@('systemInit')" +ccodecheck: "\\i !@('systemDatInit')" +output: "hello" +""" +# bug #2041: Macros need to be available for os:standalone! +import macros + +proc printf(frmt: cstring) {.varargs, header: "<stdio.h>", cdecl.} + +var x = 0 +inc x +printf("hi %ld\n", x+4777) + +proc substr(a: string): string = a[0 .. 3] # This should compile. See #9762 +const a = substr("foobar") diff --git a/tests/manyloc/standalone/barebone.nim.cfg b/tests/manyloc/standalone/barebone.nim.cfg new file mode 100644 index 000000000..b956bef8e --- /dev/null +++ b/tests/manyloc/standalone/barebone.nim.cfg @@ -0,0 +1,2 @@ +--os:standalone +--gc:none diff --git a/tests/manyloc/standalone/panicoverride.nim b/tests/manyloc/standalone/panicoverride.nim new file mode 100644 index 000000000..c0b8bb030 --- /dev/null +++ b/tests/manyloc/standalone/panicoverride.nim @@ -0,0 +1,14 @@ + +proc printf(frmt: cstring) {.varargs, importc, header: "<stdio.h>", cdecl.} +proc exit(code: int) {.importc, header: "<stdlib.h>", cdecl.} + +{.push stack_trace: off, profiler:off.} + +proc rawoutput(s: string) = + printf("%s\n", s) + +proc panic(s: string) {.noreturn.} = + rawoutput(s) + exit(1) + +{.pop.} |