diff --git a/test/5-convert.sh b/test/5-convert.sh new file mode 100755 index 0000000..c459bea --- /dev/null +++ b/test/5-convert.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e -o pipefail + +cd "$CURR_DIR"/5-convert + +temp_file=$(mktemp $(basename $0).XXXXXX) + +function cleanup { + rm $temp_file +} + +function die { + echo "$@" 1>&2 + exit 1 +} + +trap cleanup EXIT + +cp dub.sdl dub.sdl.ref + +$DUB convert -f json + +if [ -f "dub.sdl" ]; then die 'Old recipe file not removed.'; fi +if [ ! -f "dub.json" ]; then die 'New recipe file not created.'; fi + +$DUB convert -f sdl + +if [ -f "dub.json" ]; then die 'Old recipe file not removed.'; fi +if [ ! -f "dub.sdl" ]; then die 'New recipe file not created.'; fi + +if ! diff "dub.sdl" "dub.sdl.ref"; then + die 'The project data did not match the expected output!' +fi + +rm dub.sdl.ref + +echo OK \ No newline at end of file diff --git a/test/5-convert/.no_build b/test/5-convert/.no_build new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/test/5-convert/.no_build @@ -0,0 +1 @@ + diff --git a/test/5-convert/dub.sdl b/test/5-convert/dub.sdl new file mode 100644 index 0000000..598f8b5 --- /dev/null +++ b/test/5-convert/dub.sdl @@ -0,0 +1,33 @@ +name "describe-dependency-1" +version "~master" +description "A test describe project" +homepage "fake.com" +authors "nobody" +copyright "Copyright © 2015, nobody" +license "BSD 2-clause" +targetType "sourceLibrary" +dflags "--another-dflag" +lflags "--another-lflag" +libs "anotherlib" +sourceFiles "dep.lib" platform="windows" +sourceFiles "dep.a" platform="posix" +sourcePaths "source/" +copyFiles "data/*" +versions "anotherVerIdent" +debugVersions "anotherDebugVerIdent" +importPaths "source/" +preGenerateCommands "../describe-dependency-1/dependency-preGenerateCommands.sh" platform="posix" +postGenerateCommands "../describe-dependency-1/dependency-postGenerateCommands.sh" platform="posix" +preBuildCommands "../describe-dependency-1/dependency-preBuildCommands.sh" platform="posix" +postBuildCommands "../describe-dependency-1/dependency-postBuildCommands.sh" platform="posix" +buildRequirements "requireContracts" +buildOptions "stackStomping" +configuration "my-dependency-1-config" { + targetType "sourceLibrary" +} +subPackage { + name "sub1" +} +subPackage { + name "sub2" +}