From 88d01bc7fc7ce965efb87f15aa92ecc8abae8cd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Louren=C3=A7o?= Date: Sun, 13 Jun 2021 22:01:57 +0100 Subject: [PATCH] betterC: add inlineimport test runnable for betterC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: João Lourenço --- runtestsbetterc.sh | 2 ++ testsbetterc/inlineimport.d | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100755 runtestsbetterc.sh create mode 100644 testsbetterc/inlineimport.d diff --git a/runtestsbetterc.sh b/runtestsbetterc.sh new file mode 100755 index 0000000..04d5f6f --- /dev/null +++ b/runtestsbetterc.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +dmd -unittest -debug -g -betterC -I=source -i -run testsbetterc/* diff --git a/testsbetterc/inlineimport.d b/testsbetterc/inlineimport.d new file mode 100644 index 0000000..2fd5a88 --- /dev/null +++ b/testsbetterc/inlineimport.d @@ -0,0 +1,17 @@ +module testsbetterc.enumify; + +version(D_BetterC) {} else static assert(false, "Must compile with -betterC"); +version(unittest) {} else static assert(false, "Must compile with -unittest"); + +extern(C) int main() { + import core.stdc.stdio : puts, printf; + import taurus.inlineimport; + + static foreach (test; __traits(getUnitTests, __traits(parent, from))) { + printf("Running %.*s\n", cast(int) test.stringof.length, test.stringof.ptr); + test(); + } + + puts("Tests ran successfully."); + return 0; +}