Add more test cases

This commit is contained in:
Hackerpilot 2015-08-03 16:38:25 -07:00
parent da469a0579
commit eb79c2a7ab
69 changed files with 109 additions and 14 deletions

3
tests/imports/object.d Normal file
View File

@ -0,0 +1,3 @@
module object;
alias string = immutable(char)[];

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

0
tests/imports/std/conv.d Normal file
View File

View File

0
tests/imports/std/csv.d Normal file
View File

View File

View File

View File

View File

0
tests/imports/std/file.d Normal file
View File

View File

View File

View File

0
tests/imports/std/json.d Normal file
View File

View File

0
tests/imports/std/math.d Normal file
View File

View File

View File

View File

View File

View File

View File

0
tests/imports/std/path.d Normal file
View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

0
tests/imports/std/uni.d Normal file
View File

0
tests/imports/std/uri.d Normal file
View File

0
tests/imports/std/utf.d Normal file
View File

0
tests/imports/std/uuid.d Normal file
View File

View File

0
tests/imports/std/xml.d Normal file
View File

0
tests/imports/std/zip.d Normal file
View File

0
tests/imports/std/zlib.d Normal file
View File

View File

@ -0,0 +1,6 @@
module testfile1;
class Base
{
int z;
}

View File

@ -2,12 +2,25 @@ RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
NORMAL="\033[0m"
IMPORTS=$(pwd)/imports
fail_count=0
pass_count=0
# Make sure that the server is shut down
echo "Shutting down currently-running server..."
../bin/dcd-client --shutdown 2>/dev/null > /dev/null
sleep 1s;
# Start up the server
echo "Starting server..."
../bin/dcd-server --ignoreConfig -I $IMPORTS 2>/dev/null > /dev/null &
sleep 1s;
# Run tests
for testCase in tc*; do
cd $testCase;
./run.sh;
if [ $? -eq 0 ]; then
echo -e "${YELLOW}$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}";
@ -16,9 +29,15 @@ for testCase in tc*; do
echo -e "${YELLOW}$testCase:${NORMAL} ... ${RED}Fail${NORMAL}";
let fail_count=fail_count+1
fi
cd - > /dev/null;
done
# Shut down
echo "Shutting down server..."
../bin/dcd-client --shutdown 2>/dev/null > /dev/null
# Report
if [ $fail_count -eq 0 ]; then
echo -e "${GREEN}${pass_count} tests passed and ${fail_count} failed.${NORMAL}"
else

View File

@ -4,20 +4,20 @@ S doStuff(int x) { return S(); }
void main(string[] args)
{
auto a = 10;
auto b = S(1, 2);
int c = 4;
auto d = doStuff();
auto alpha = 10;
auto bravo = S(1, 2);
int charlie = 4;
auto delta = doStuff();
{
a.
alpha.
}
{
b.
bravo.
}
{
c.
charlie.
}
{
d.
delta.
}
}

View File

@ -1,14 +1,14 @@
set -e
set -u
dcd-client file.d -c162 > actual1.txt
dcd-client file.d -c184 > actual1.txt
diff actual1.txt expected1.txt
dcd-client file.d -c173 > actual2.txt
dcd-client file.d -c199 > actual2.txt
diff actual2.txt expected2.txt
dcd-client file.d -c184 > actual3.txt
dcd-client file.d -c216 > actual3.txt
diff actual3.txt expected3.txt
dcd-client file.d -c195 > actual4.txt
dcd-client file.d -c231 > actual4.txt
diff actual4.txt expected4.txt

View File

@ -2,8 +2,10 @@ set -e
set -u
dcd-client file.d -c83 > actual1.txt
dcd-client file.d -c93 > actual2.txt
dcd-client file.d -c148 > actual3.txt
diff actual1.txt expected1.txt
dcd-client file.d -c93 > actual2.txt
diff actual2.txt expected2.txt
dcd-client file.d -c148 > actual3.txt
diff actual3.txt expected3.txt

12
tests/tc010/expected1.txt Normal file
View File

@ -0,0 +1,12 @@
identifiers
__monitor v
__vptr v
alignof k
classinfo v
init k
mangleof k
sizeof k
stringof k
tupleof v
x v
y v

12
tests/tc010/expected2.txt Normal file
View File

@ -0,0 +1,12 @@
identifiers
__monitor v
__vptr v
alignof k
classinfo v
init k
mangleof k
sizeof k
stringof k
tupleof v
x v
z v

12
tests/tc010/file.d Normal file
View File

@ -0,0 +1,12 @@
import testfile1;
class Inherits : Base
{
int x;
}
void main()
{
Inherits i;
i.
}

17
tests/tc010/run.sh Executable file
View File

@ -0,0 +1,17 @@
set -e
set -u
cp testfile1_old.d ../imports/testfile1.d
# Sleep because modification times aren't stored with granularity of less
# than one second
sleep 1s;
dcd-client file.d -c84 > actual1.txt
diff actual1.txt expected1.txt
cp testfile1_new.d ../imports/testfile1.d
# Same here
sleep 1s;
dcd-client file.d -c84 > actual2.txt
diff actual2.txt expected2.txt

View File

@ -0,0 +1,6 @@
module testfile1;
class Base
{
int z;
}

View File

@ -0,0 +1,6 @@
module testfile1;
class Base
{
int y;
}