Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Commit

Permalink
auto testing of library
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 committed Aug 12, 2017
1 parent 704a60c commit a9d70a5
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 166 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -5,4 +5,4 @@ d:
os:
- linux
- osx
script: dub test --compiler=${DC}
script: dub test --compiler=${DC} && cd test && bash runtests.sh ${DC}
2 changes: 0 additions & 2 deletions dub.json
Expand Up @@ -15,8 +15,6 @@
"dfmt": "~>0.5.0"
},
"subPackages": [
"./test",
"./test/library",
"./installer",
"./dml"
],
Expand Down
2 changes: 2 additions & 0 deletions test/.gitignore
@@ -0,0 +1,2 @@
*/test-*
testout.txt
5 changes: 0 additions & 5 deletions test/dub.json

This file was deleted.

8 changes: 0 additions & 8 deletions test/library/dub.json

This file was deleted.

47 changes: 0 additions & 47 deletions test/library/source/tester.d

This file was deleted.

36 changes: 36 additions & 0 deletions test/runtests.sh
@@ -0,0 +1,36 @@
#!/bin/bash

RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
NORMAL="\033[0m"

COMPILER="$1"

fail_count=0
pass_count=0

echo "Running tests with ${COMPILER}..."

for testCase in tc*; do
cd $testCase

dub --compiler="${COMPILER}" >testout.txt 2>&1
if [[ $? -eq 0 ]]; then
echo -e "${YELLOW}$socket:$testCase:${NORMAL} ... ${GREEN}Pass${NORMAL}";
let pass_count=pass_count+1
else
echo -e "${YELLOW}$socket:$testCase:${NORMAL} ... ${RED}Fail${NORMAL}";
cat testout.txt
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
3 changes: 3 additions & 0 deletions test/tc_dub/dub.sdl
@@ -0,0 +1,3 @@
name "test-dub"

dependency "workspace-d" path="../.."
30 changes: 30 additions & 0 deletions test/tc_dub/source/app.d
@@ -0,0 +1,30 @@
import std.file;
import std.string;

import workspaced.api;
import workspaced.coms;

void main()
{
dub.startup(getcwd);
scope (exit)
dub.stop();
dub.upgrade();
assert(dub.dependencies.length > 2);
assert(dub.rootDependencies == ["workspace-d"]);
assert(dub.imports.length > 5);
assert(dub.stringImports[0].endsWith("views")
|| dub.stringImports[0].endsWith("views/") || dub.stringImports[0].endsWith("views\\"));
assert(dub.fileImports.length > 10);
assert(dub.configurations.length == 2);
assert(dub.buildTypes.length);
assert(dub.configuration == "application");
assert(dub.archTypes.length);
assert(dub.archType.length);
assert(dub.buildType == "debug");
assert(dub.compiler.length);
assert(dub.name == "test-dub");
assert(dub.path.toString.endsWith("tc_dub")
|| dub.path.toString.endsWith("tc_dub/") || dub.path.toString.endsWith("tc_dub\\"));
assert(syncBlocking!(dub.build).array.length == 0);
}
3 changes: 3 additions & 0 deletions test/tc_fsworkspace/dub.sdl
@@ -0,0 +1,3 @@
name "test-fsworkspace"

dependency "workspace-d" path="../.."
15 changes: 15 additions & 0 deletions test/tc_fsworkspace/source/app.d
@@ -0,0 +1,15 @@
import std.file;
import std.string;

import workspaced.api;
import workspaced.coms;

void main()
{
assert(importPathProvider().length == 0);
fsworkspace.start(getcwd);
fsworkspace.addImports(["source"]);
assert(importPathProvider() == [getcwd, "source"]);
fsworkspace.stop();
assert(importPathProvider().length == 0);
}
3 changes: 3 additions & 0 deletions test/tc_integrated_dfmt/dub.sdl
@@ -0,0 +1,3 @@
name "test-dfmt"

dependency "workspace-d" path="../.."
10 changes: 10 additions & 0 deletions test/tc_integrated_dfmt/source/app.d
@@ -0,0 +1,10 @@
import std.file;
import std.string;

import workspaced.api;
import workspaced.coms;

void main()
{
assert(syncBlocking!(dfmt.format)("void main(){}").str.splitLines.length > 1);
}
103 changes: 0 additions & 103 deletions test/tester.d

This file was deleted.

0 comments on commit a9d70a5

Please sign in to comment.