diff --git a/.gitignore b/.gitignore index fededf6..882534c 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,6 @@ callgrind.* # Git hash file githash.txt + +# Test results +tests/tc*/actual.txt diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..ae45e99 --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,27 @@ +RED="\033[31m" +GREEN="\033[32m" +YELLOW="\033[33m" +NORMAL="\033[0m" + +fail_count=0 +pass_count=0 + +for testCase in tc*; do + cd $testCase; + ./run.sh; + if [ $? -eq 0 ]; then + echo -e "${YELLOW}$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}"; + let pass_count=pass_count+1 + else + echo -e "${YELLOW}$testCase:${NORMAL} ... ${RED}Fail${NORMAL}"; + let fail_count=fail_count+1 + fi + cd - > /dev/null; +done + +if [ $fail_count -eq 0 ]; then + echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}" +else + echo -e "${RED}${pass_count} tests passed and ${fail_count} failed.${NORMAL}" + exit 1 +fi diff --git a/tests/tc001/expected.txt b/tests/tc001/expected.txt new file mode 100644 index 0000000..49b7de4 --- /dev/null +++ b/tests/tc001/expected.txt @@ -0,0 +1,66 @@ +identifiers +algorithm M +allocator M +array M +ascii M +base64 M +bigint M +bitmanip M +c P +compiler M +complex M +concurrency M +container M +conv M +cstream M +csv M +d P +datetime M +demangle M +digest P +encoding M +exception M +experimental P +file M +format M +functional M +getopt M +internal P +json M +lexer M +math M +mathspecial M +metastrings M +mmfile M +net P +numeric M +outbuffer M +parallelism M +path M +process M +random M +range M +regex M +signals M +socket M +socketstream M +stdint M +stdio M +stdiobase M +stream M +string M +syserror M +system M +traits M +typecons M +typelist M +typetuple M +uni M +uri M +utf M +uuid M +variant M +windows P +xml M +zip M +zlib M diff --git a/tests/tc001/file.d b/tests/tc001/file.d new file mode 100644 index 0000000..b6e35f2 --- /dev/null +++ b/tests/tc001/file.d @@ -0,0 +1 @@ +import std. diff --git a/tests/tc001/run.sh b/tests/tc001/run.sh new file mode 100755 index 0000000..efee50c --- /dev/null +++ b/tests/tc001/run.sh @@ -0,0 +1,5 @@ +set -e +set -u + +dcd-client file.d -c12 > actual.txt +diff actual.txt expected.txt diff --git a/tests/tc002/expected.txt b/tests/tc002/expected.txt new file mode 100644 index 0000000..1f0d82d --- /dev/null +++ b/tests/tc002/expected.txt @@ -0,0 +1,9 @@ +identifiers +alignof k +init k +mangleof k +sizeof k +stringof k +tupleof k +x v +y v diff --git a/tests/tc002/file.d b/tests/tc002/file.d new file mode 100644 index 0000000..b36ed16 --- /dev/null +++ b/tests/tc002/file.d @@ -0,0 +1 @@ +struct S { int x; int y; } void doStuff() { S s; s. } diff --git a/tests/tc002/run.sh b/tests/tc002/run.sh new file mode 100755 index 0000000..6a6274e --- /dev/null +++ b/tests/tc002/run.sh @@ -0,0 +1,5 @@ +set -e +set -u + +dcd-client file.d -c52 > actual.txt +diff actual.txt expected.txt diff --git a/tests/tc003/file.d b/tests/tc003/file.d new file mode 100644 index 0000000..00b6f7a --- /dev/null +++ b/tests/tc003/file.d @@ -0,0 +1,51 @@ +abstract class InheritMe(T) +{ + final abstract class GrandChild(U, V) + { + /// I am uvalue + static U uvalue; + + /// I am vvalue + static V vvalue; + + /// I am setGrandChild + static void setGrandChild(alias X, alias Y)() + { + X = Y; + } + } +} + + +final abstract class Parent(T) +{ + /// I am stringChild + final abstract class StringChild : InheritMe!(string) + { + /// I am a string GrandChild + alias s = GrandChild!(T, string); + + /// I am an int GrandChild + alias i = GrandChild!(T, int); + } + + /// I am a parentF + static void parentF() + { + + } +} + +/// I am stringParent +alias stringParent = Parent!string; + +void main(string[] args) +{ + with(stringParent.StringChild.s) + { + setGrandChild + !( + uvalue, "test", + )(); + } +} diff --git a/tests/tc003/run.sh b/tests/tc003/run.sh new file mode 100755 index 0000000..ab35182 --- /dev/null +++ b/tests/tc003/run.sh @@ -0,0 +1,5 @@ +set -e +set -u + +dcd-client file.d -c863 > actual.txt +diff actual.txt expected.txt