diff --git a/.gitignore b/.gitignore index 6d538b9..c48505d 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ /test/ignore-hidden-2/ignore-hidden-2 /test/expected-import-path-output /test/expected-string-import-path-output -/test/expected-describe-data-dmd-output -/test/expected-describe-data-list-output +/test/expected-describe-data-1-list-output +/test/expected-describe-data-2-dmd-output /test/describe-project/dummy.dat /test/describe-project/dummy-dep1.dat diff --git a/test/4-describe-data-1-list.sh b/test/4-describe-data-1-list.sh new file mode 100755 index 0000000..c0e848e --- /dev/null +++ b/test/4-describe-data-1-list.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +set -e -o pipefail + +cd "$CURR_DIR"/describe-project + +temp_file=`mktemp` + +function cleanup { + rm $temp_file +} + +trap cleanup EXIT + +if ! $DUB describe --compiler=$COMPILER --data-list \ + '--data= target-type , target-path , target-name ' \ + '--data= working-directory ' \ + --data=main-source-file \ + '--data=dflags,lflags' \ + '--data=libs, linker-files' \ + '--data=source-files, copy-files' \ + '--data=versions, debug-versions' \ + --data=import-paths \ + --data=string-import-paths \ + --data=import-files \ + --data=string-import-files \ + --data=pre-generate-commands \ + --data=post-generate-commands \ + --data=pre-build-commands \ + --data=post-build-commands \ + '--data=requirements, options' \ + > "$temp_file"; then + die 'Printing project data failed!' +fi + +# Create the expected output path file to compare against. +expected_file="$CURR_DIR/expected-describe-data-1-list-output" +# --data=target-type +echo "executable" > "$expected_file" +echo >> "$expected_file" +# --data=target-path +echo "$CURR_DIR/describe-project/" >> "$expected_file" +echo >> "$expected_file" +# --data=target-name +echo "describe-project" >> "$expected_file" +echo >> "$expected_file" +# --data=working-directory +echo "$CURR_DIR/describe-project/" >> "$expected_file" +echo >> "$expected_file" +# --data=main-source-file +echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file" +echo >> "$expected_file" +# --data=dflags +echo "--some-dflag" >> "$expected_file" +echo "--another-dflag" >> "$expected_file" +echo >> "$expected_file" +# --data=lflags +echo "--some-lflag" >> "$expected_file" +echo "--another-lflag" >> "$expected_file" +echo >> "$expected_file" +# --data=libs +echo "crypto" >> "$expected_file" +echo "curl" >> "$expected_file" +echo >> "$expected_file" +# --data=linker-files +echo "$CURR_DIR/describe-dependency-3/libdescribe-dependency-3.a" >> "$expected_file" +echo >> "$expected_file" +# --data=source-files +echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-1/source/dummy.d" >> "$expected_file" +echo >> "$expected_file" +# --data=copy-files +echo "$CURR_DIR/describe-project/data/dummy.dat" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-1/data/*" >> "$expected_file" +echo >> "$expected_file" +# --data=versions +echo "someVerIdent" >> "$expected_file" +echo "anotherVerIdent" >> "$expected_file" +echo "Have_describe_project" >> "$expected_file" +echo "Have_describe_dependency_1" >> "$expected_file" +echo "Have_describe_dependency_2" >> "$expected_file" +echo "Have_describe_dependency_3" >> "$expected_file" +echo >> "$expected_file" +# --data=debug-versions +echo "someDebugVerIdent" >> "$expected_file" +echo "anotherDebugVerIdent" >> "$expected_file" +echo >> "$expected_file" +# --data=import-paths +echo "$CURR_DIR/describe-project/src/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-1/source/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-2/some-path/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-3/dep3-source/" >> "$expected_file" +echo >> "$expected_file" +# --data=string-import-paths +echo "$CURR_DIR/describe-project/views/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$expected_file" +echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$expected_file" +echo >> "$expected_file" +# --data=import-files +echo "$CURR_DIR/describe-dependency-2/some-path/dummy.d" >> "$expected_file" +echo >> "$expected_file" +# --data=string-import-files +echo "$CURR_DIR/describe-project/views/dummy.d" >> "$expected_file" +#echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/dummy.d" >> "$expected_file" # This is missing from result, is that a bug? +echo >> "$expected_file" +# --data=pre-generate-commands +echo "./do-preGenerateCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-preGenerateCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=post-generate-commands +echo "./do-postGenerateCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-postGenerateCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=pre-build-commands +echo "./do-preBuildCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-preBuildCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=post-build-commands +echo "./do-postBuildCommands.sh" >> "$expected_file" +echo "../describe-dependency-1/dependency-postBuildCommands.sh" >> "$expected_file" +echo >> "$expected_file" +# --data=requirements +echo "allowWarnings" >> "$expected_file" +echo "disallowInlining" >> "$expected_file" +#echo "requireContracts" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result +echo >> "$expected_file" +# --data=options +echo "debugMode" >> "$expected_file" +echo "releaseMode" >> "$expected_file" +echo "debugInfo" >> "$expected_file" +echo "warnings" >> "$expected_file" +#echo "stackStomping" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result + +if ! diff "$expected_file" "$temp_file"; then + die 'The project data did not match the expected output!' +fi + diff --git a/test/4-describe-data-2-dmd.sh b/test/4-describe-data-2-dmd.sh new file mode 100755 index 0000000..8dd54e0 --- /dev/null +++ b/test/4-describe-data-2-dmd.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +set -e -o pipefail + +if ! dmd --help >/dev/null; then + echo Skipping DMD-centric test on configuration that lacks DMD. + exit +fi + +cd "$CURR_DIR"/describe-project + +temp_file=`mktemp` + +function cleanup { + rm $temp_file +} + +trap cleanup EXIT + +if ! $DUB describe --compiler=dmd \ + --data=main-source-file \ + --data=dflags,lflags \ + --data=libs,linker-files \ + --data=source-files \ + --data=versions \ + --data=debug-versions \ + --data=import-paths \ + --data=string-import-paths \ + --data=import-files \ + --data=options \ + > "$temp_file"; then + die 'Printing project data failed!' +fi + +# Create the expected output path file to compare against. +expected_file="$CURR_DIR/expected-describe-data-2-dmd-output" +# --data=main-source-file +echo -n "'$CURR_DIR/describe-project/src/dummy.d' " > "$expected_file" +# --data=dflags +echo -n "--some-dflag " >> "$expected_file" +echo -n "--another-dflag " >> "$expected_file" +# --data=lflags +echo -n "-L--some-lflag " >> "$expected_file" +echo -n "-L--another-lflag " >> "$expected_file" +# --data=libs +echo -n "-lcrypto " >> "$expected_file" +echo -n "-lcurl " >> "$expected_file" +# --data=linker-files +echo -n "'$CURR_DIR/describe-dependency-3/libdescribe-dependency-3.a' " >> "$expected_file" +# --data=source-files +echo -n "'$CURR_DIR/describe-project/src/dummy.d' " >> "$expected_file" +echo -n "'$CURR_DIR/describe-dependency-1/source/dummy.d' " >> "$expected_file" +# --data=versions +echo -n "-version=someVerIdent " >> "$expected_file" +echo -n "-version=anotherVerIdent " >> "$expected_file" +echo -n "-version=Have_describe_project " >> "$expected_file" +echo -n "-version=Have_describe_dependency_1 " >> "$expected_file" +echo -n "-version=Have_describe_dependency_2 " >> "$expected_file" +echo -n "-version=Have_describe_dependency_3 " >> "$expected_file" +# --data=debug-versions +echo -n "-debug=someDebugVerIdent " >> "$expected_file" +echo -n "-debug=anotherDebugVerIdent " >> "$expected_file" +# --data=import-paths +echo -n "'-I$CURR_DIR/describe-project/src/' " >> "$expected_file" +echo -n "'-I$CURR_DIR/describe-dependency-1/source/' " >> "$expected_file" +echo -n "'-I$CURR_DIR/describe-dependency-2/some-path/' " >> "$expected_file" +echo -n "'-I$CURR_DIR/describe-dependency-3/dep3-source/' " >> "$expected_file" +# --data=string-import-paths +echo -n "'-J$CURR_DIR/describe-project/views/' " >> "$expected_file" +echo -n "'-J$CURR_DIR/describe-dependency-2/some-extra-string-import-path/' " >> "$expected_file" +echo -n "'-J$CURR_DIR/describe-dependency-3/dep3-string-import-path/' " >> "$expected_file" +# --data=import-files +echo -n "'$CURR_DIR/describe-dependency-2/some-path/dummy.d' " >> "$expected_file" +# --data=options +echo -n "-debug " >> "$expected_file" +echo -n "-release " >> "$expected_file" +echo -n "-g " >> "$expected_file" +echo -n "-wi" >> "$expected_file" +#echo -n "-gx " >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result +echo "" >> "$expected_file" + +if ! diff "$expected_file" "$temp_file"; then + die 'The project data did not match the expected output!' +fi + diff --git a/test/4-describe-data-3-zero-delim.sh b/test/4-describe-data-3-zero-delim.sh new file mode 100755 index 0000000..68a749b --- /dev/null +++ b/test/4-describe-data-3-zero-delim.sh @@ -0,0 +1,127 @@ +#!/bin/bash + +set -e -o pipefail + +cd "$CURR_DIR"/describe-project + +temp_file_normal=`mktemp` +temp_file_zero_delim=`mktemp` + +function cleanup { + rm $temp_file_normal + rm $temp_file_zero_delim +} + +trap cleanup EXIT + +# Test list-style project data +if ! $DUB describe --compiler=$COMPILER --data-list \ + --data=target-type \ + --data=target-path \ + --data=target-name \ + --data=working-directory \ + --data=main-source-file \ + --data=dflags \ + --data=lflags \ + --data=libs \ + --data=linker-files \ + --data=source-files \ + --data=copy-files \ + --data=versions \ + --data=debug-versions \ + --data=import-paths \ + --data=string-import-paths \ + --data=import-files \ + --data=string-import-files \ + --data=pre-generate-commands \ + --data=post-generate-commands \ + --data=pre-build-commands \ + --data=post-build-commands \ + --data=requirements \ + --data=options \ + > "$temp_file_normal"; then + die 'Printing list-style project data failed!' +fi + +if ! $DUB describe --compiler=$COMPILER --data-0 --data-list \ + --data=target-type \ + --data=target-path \ + --data=target-name \ + --data=working-directory \ + --data=main-source-file \ + --data=dflags \ + --data=lflags \ + --data=libs \ + --data=linker-files \ + --data=source-files \ + --data=copy-files \ + --data=versions \ + --data=debug-versions \ + --data=import-paths \ + --data=string-import-paths \ + --data=import-files \ + --data=string-import-files \ + --data=pre-generate-commands \ + --data=post-generate-commands \ + --data=pre-build-commands \ + --data=post-build-commands \ + --data=requirements \ + --data=options \ + | xargs -0 printf "%s\n" > "$temp_file_zero_delim"; then + die 'Printing null-delimited list-style project data failed!' +fi + +if ! diff -Z "$temp_file_normal" "$temp_file_zero_delim"; then + die 'The null-delimited list-style project data did not match the expected output!' +fi + +# Test --import-paths +if ! $DUB describe --compiler=$COMPILER --import-paths \ + > "$temp_file_normal"; then + die 'Printing --import-paths failed!' +fi + +if ! $DUB describe --compiler=$COMPILER --data-0 --import-paths \ + | xargs -0 printf "%s\n" > "$temp_file_zero_delim"; then + die 'Printing null-delimited --import-paths failed!' +fi + +if ! diff -Z -B "$temp_file_normal" "$temp_file_zero_delim"; then + die 'The null-delimited --import-paths data did not match the expected output!' +fi + +# DMD-only beyond this point +if ! dmd --help >/dev/null; then + echo Skipping DMD-centric tests on configuration that lacks DMD. + exit +fi + +# Test dmd-style --data=versions +if ! $DUB describe --compiler=dmd --data=versions \ + > "$temp_file_normal"; then + die 'Printing dmd-style --data=versions failed!' +fi + +if ! $DUB describe --compiler=dmd --data-0 --data=versions \ + | xargs -0 printf "%s " > "$temp_file_zero_delim"; then + die 'Printing null-delimited dmd-style --data=versions failed!' +fi + +if ! diff -Z "$temp_file_normal" "$temp_file_zero_delim"; then + die 'The null-delimited dmd-style --data=versions did not match the expected output!' +fi + +# Test dmd-style --data=source-files +if ! $DUB describe --compiler=dmd --data=source-files \ + > "$temp_file_normal"; then + die 'Printing dmd-style --data=source-files failed!' +fi + +if ! $DUB describe --compiler=dmd --data-0 --data=source-files \ + | xargs -0 printf "'%s' " > "$temp_file_zero_delim"; then + die 'Printing null-delimited dmd-style --data=source-files failed!' +fi + +if ! diff -Z "$temp_file_normal" "$temp_file_zero_delim"; then + die 'The null-delimited dmd-style --data=source-files did not match the expected output!' +fi diff --git a/test/4-describe-data-dmd.sh b/test/4-describe-data-dmd.sh deleted file mode 100755 index b5459df..0000000 --- a/test/4-describe-data-dmd.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -if ! dmd --help >/dev/null; then - echo Skipping DMD-centric test on configuration that lacks DMD. - exit -fi - -cd "$CURR_DIR"/describe-project - -temp_file=`mktemp` - -function cleanup { - rm $temp_file -} - -trap cleanup EXIT - -if ! $DUB describe --compiler=dmd \ - --data=main-source-file \ - --data=dflags,lflags \ - --data=libs,linker-files \ - --data=source-files \ - --data=versions \ - --data=debug-versions \ - --data=import-paths \ - --data=string-import-paths \ - --data=import-files \ - --data=options \ - > "$temp_file"; then - die 'Printing project data failed!' -fi - -# Create the expected output path file to compare against. -expected_file="$CURR_DIR/expected-describe-data-dmd-output" -# --data=main-source-file -echo -n "'$CURR_DIR/describe-project/src/dummy.d' " > "$expected_file" -# --data=dflags -echo -n "--some-dflag " >> "$expected_file" -echo -n "--another-dflag " >> "$expected_file" -# --data=lflags -echo -n "-L--some-lflag " >> "$expected_file" -echo -n "-L--another-lflag " >> "$expected_file" -# --data=libs -echo -n "-lcrypto " >> "$expected_file" -echo -n "-lcurl " >> "$expected_file" -# --data=linker-files -echo -n "'$CURR_DIR/describe-dependency-3/libdescribe-dependency-3.a' " >> "$expected_file" -# --data=source-files -echo -n "'$CURR_DIR/describe-project/src/dummy.d' " >> "$expected_file" -echo -n "'$CURR_DIR/describe-dependency-1/source/dummy.d' " >> "$expected_file" -# --data=versions -echo -n "-version=someVerIdent " >> "$expected_file" -echo -n "-version=anotherVerIdent " >> "$expected_file" -echo -n "-version=Have_describe_project " >> "$expected_file" -echo -n "-version=Have_describe_dependency_1 " >> "$expected_file" -echo -n "-version=Have_describe_dependency_2 " >> "$expected_file" -echo -n "-version=Have_describe_dependency_3 " >> "$expected_file" -# --data=debug-versions -echo -n "-debug=someDebugVerIdent " >> "$expected_file" -echo -n "-debug=anotherDebugVerIdent " >> "$expected_file" -# --data=import-paths -echo -n "'-I$CURR_DIR/describe-project/src/' " >> "$expected_file" -echo -n "'-I$CURR_DIR/describe-dependency-1/source/' " >> "$expected_file" -echo -n "'-I$CURR_DIR/describe-dependency-2/some-path/' " >> "$expected_file" -echo -n "'-I$CURR_DIR/describe-dependency-3/dep3-source/' " >> "$expected_file" -# --data=string-import-paths -echo -n "'-J$CURR_DIR/describe-project/views/' " >> "$expected_file" -echo -n "'-J$CURR_DIR/describe-dependency-2/some-extra-string-import-path/' " >> "$expected_file" -echo -n "'-J$CURR_DIR/describe-dependency-3/dep3-string-import-path/' " >> "$expected_file" -# --data=import-files -echo -n "'$CURR_DIR/describe-dependency-2/some-path/dummy.d' " >> "$expected_file" -# --data=options -echo -n "-debug " >> "$expected_file" -echo -n "-release " >> "$expected_file" -echo -n "-g " >> "$expected_file" -echo -n "-wi" >> "$expected_file" -#echo -n "-gx " >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result -echo "" >> "$expected_file" - -if ! diff "$expected_file" "$temp_file"; then - die 'The project data did not match the expected output!' -fi - diff --git a/test/4-describe-data-list.sh b/test/4-describe-data-list.sh deleted file mode 100755 index e9fcb73..0000000 --- a/test/4-describe-data-list.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -cd "$CURR_DIR"/describe-project - -temp_file=`mktemp` - -function cleanup { - rm $temp_file -} - -trap cleanup EXIT - -if ! $DUB describe --compiler=$COMPILER --data-list \ - '--data= target-type , target-path , target-name ' \ - '--data= working-directory ' \ - --data=main-source-file \ - '--data=dflags,lflags' \ - '--data=libs, linker-files' \ - '--data=source-files, copy-files' \ - '--data=versions, debug-versions' \ - --data=import-paths \ - --data=string-import-paths \ - --data=import-files \ - --data=string-import-files \ - --data=pre-generate-commands \ - --data=post-generate-commands \ - --data=pre-build-commands \ - --data=post-build-commands \ - '--data=requirements, options' \ - > "$temp_file"; then - die 'Printing project data failed!' -fi - -# Create the expected output path file to compare against. -expected_file="$CURR_DIR/expected-describe-data-output" -# --data=target-type -echo "executable" > "$expected_file" -echo >> "$expected_file" -# --data=target-path -echo "$CURR_DIR/describe-project/" >> "$expected_file" -echo >> "$expected_file" -# --data=target-name -echo "describe-project" >> "$expected_file" -echo >> "$expected_file" -# --data=working-directory -echo "$CURR_DIR/describe-project/" >> "$expected_file" -echo >> "$expected_file" -# --data=main-source-file -echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file" -echo >> "$expected_file" -# --data=dflags -echo "--some-dflag" >> "$expected_file" -echo "--another-dflag" >> "$expected_file" -echo >> "$expected_file" -# --data=lflags -echo "--some-lflag" >> "$expected_file" -echo "--another-lflag" >> "$expected_file" -echo >> "$expected_file" -# --data=libs -echo "crypto" >> "$expected_file" -echo "curl" >> "$expected_file" -echo >> "$expected_file" -# --data=linker-files -echo "$CURR_DIR/describe-dependency-3/libdescribe-dependency-3.a" >> "$expected_file" -echo >> "$expected_file" -# --data=source-files -echo "$CURR_DIR/describe-project/src/dummy.d" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-1/source/dummy.d" >> "$expected_file" -echo >> "$expected_file" -# --data=copy-files -echo "$CURR_DIR/describe-project/data/dummy.dat" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-1/data/*" >> "$expected_file" -echo >> "$expected_file" -# --data=versions -echo "someVerIdent" >> "$expected_file" -echo "anotherVerIdent" >> "$expected_file" -echo "Have_describe_project" >> "$expected_file" -echo "Have_describe_dependency_1" >> "$expected_file" -echo "Have_describe_dependency_2" >> "$expected_file" -echo "Have_describe_dependency_3" >> "$expected_file" -echo >> "$expected_file" -# --data=debug-versions -echo "someDebugVerIdent" >> "$expected_file" -echo "anotherDebugVerIdent" >> "$expected_file" -echo >> "$expected_file" -# --data=import-paths -echo "$CURR_DIR/describe-project/src/" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-1/source/" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-2/some-path/" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-3/dep3-source/" >> "$expected_file" -echo >> "$expected_file" -# --data=string-import-paths -echo "$CURR_DIR/describe-project/views/" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$expected_file" -echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$expected_file" -echo >> "$expected_file" -# --data=import-files -echo "$CURR_DIR/describe-dependency-2/some-path/dummy.d" >> "$expected_file" -echo >> "$expected_file" -# --data=string-import-files -echo "$CURR_DIR/describe-project/views/dummy.d" >> "$expected_file" -#echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/dummy.d" >> "$expected_file" # This is missing from result, is that a bug? -echo >> "$expected_file" -# --data=pre-generate-commands -echo "./do-preGenerateCommands.sh" >> "$expected_file" -echo "../describe-dependency-1/dependency-preGenerateCommands.sh" >> "$expected_file" -echo >> "$expected_file" -# --data=post-generate-commands -echo "./do-postGenerateCommands.sh" >> "$expected_file" -echo "../describe-dependency-1/dependency-postGenerateCommands.sh" >> "$expected_file" -echo >> "$expected_file" -# --data=pre-build-commands -echo "./do-preBuildCommands.sh" >> "$expected_file" -echo "../describe-dependency-1/dependency-preBuildCommands.sh" >> "$expected_file" -echo >> "$expected_file" -# --data=post-build-commands -echo "./do-postBuildCommands.sh" >> "$expected_file" -echo "../describe-dependency-1/dependency-postBuildCommands.sh" >> "$expected_file" -echo >> "$expected_file" -# --data=requirements -echo "allowWarnings" >> "$expected_file" -echo "disallowInlining" >> "$expected_file" -#echo "requireContracts" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result -echo >> "$expected_file" -# --data=options -echo "debugMode" >> "$expected_file" -echo "releaseMode" >> "$expected_file" -echo "debugInfo" >> "$expected_file" -echo "warnings" >> "$expected_file" -#echo "stackStomping" >> "$expected_file" # Not sure if this (from a sourceLib dependency) should be missing from the result - -if ! diff "$expected_file" "$temp_file"; then - die 'The project data did not match the expected output!' -fi - diff --git a/test/4-describe-data-zero-delim.sh b/test/4-describe-data-zero-delim.sh deleted file mode 100755 index 68a749b..0000000 --- a/test/4-describe-data-zero-delim.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -cd "$CURR_DIR"/describe-project - -temp_file_normal=`mktemp` -temp_file_zero_delim=`mktemp` - -function cleanup { - rm $temp_file_normal - rm $temp_file_zero_delim -} - -trap cleanup EXIT - -# Test list-style project data -if ! $DUB describe --compiler=$COMPILER --data-list \ - --data=target-type \ - --data=target-path \ - --data=target-name \ - --data=working-directory \ - --data=main-source-file \ - --data=dflags \ - --data=lflags \ - --data=libs \ - --data=linker-files \ - --data=source-files \ - --data=copy-files \ - --data=versions \ - --data=debug-versions \ - --data=import-paths \ - --data=string-import-paths \ - --data=import-files \ - --data=string-import-files \ - --data=pre-generate-commands \ - --data=post-generate-commands \ - --data=pre-build-commands \ - --data=post-build-commands \ - --data=requirements \ - --data=options \ - > "$temp_file_normal"; then - die 'Printing list-style project data failed!' -fi - -if ! $DUB describe --compiler=$COMPILER --data-0 --data-list \ - --data=target-type \ - --data=target-path \ - --data=target-name \ - --data=working-directory \ - --data=main-source-file \ - --data=dflags \ - --data=lflags \ - --data=libs \ - --data=linker-files \ - --data=source-files \ - --data=copy-files \ - --data=versions \ - --data=debug-versions \ - --data=import-paths \ - --data=string-import-paths \ - --data=import-files \ - --data=string-import-files \ - --data=pre-generate-commands \ - --data=post-generate-commands \ - --data=pre-build-commands \ - --data=post-build-commands \ - --data=requirements \ - --data=options \ - | xargs -0 printf "%s\n" > "$temp_file_zero_delim"; then - die 'Printing null-delimited list-style project data failed!' -fi - -if ! diff -Z "$temp_file_normal" "$temp_file_zero_delim"; then - die 'The null-delimited list-style project data did not match the expected output!' -fi - -# Test --import-paths -if ! $DUB describe --compiler=$COMPILER --import-paths \ - > "$temp_file_normal"; then - die 'Printing --import-paths failed!' -fi - -if ! $DUB describe --compiler=$COMPILER --data-0 --import-paths \ - | xargs -0 printf "%s\n" > "$temp_file_zero_delim"; then - die 'Printing null-delimited --import-paths failed!' -fi - -if ! diff -Z -B "$temp_file_normal" "$temp_file_zero_delim"; then - die 'The null-delimited --import-paths data did not match the expected output!' -fi - -# DMD-only beyond this point -if ! dmd --help >/dev/null; then - echo Skipping DMD-centric tests on configuration that lacks DMD. - exit -fi - -# Test dmd-style --data=versions -if ! $DUB describe --compiler=dmd --data=versions \ - > "$temp_file_normal"; then - die 'Printing dmd-style --data=versions failed!' -fi - -if ! $DUB describe --compiler=dmd --data-0 --data=versions \ - | xargs -0 printf "%s " > "$temp_file_zero_delim"; then - die 'Printing null-delimited dmd-style --data=versions failed!' -fi - -if ! diff -Z "$temp_file_normal" "$temp_file_zero_delim"; then - die 'The null-delimited dmd-style --data=versions did not match the expected output!' -fi - -# Test dmd-style --data=source-files -if ! $DUB describe --compiler=dmd --data=source-files \ - > "$temp_file_normal"; then - die 'Printing dmd-style --data=source-files failed!' -fi - -if ! $DUB describe --compiler=dmd --data-0 --data=source-files \ - | xargs -0 printf "'%s' " > "$temp_file_zero_delim"; then - die 'Printing null-delimited dmd-style --data=source-files failed!' -fi - -if ! diff -Z "$temp_file_normal" "$temp_file_zero_delim"; then - die 'The null-delimited dmd-style --data=source-files did not match the expected output!' -fi diff --git a/test/4-describe-string-import-paths.sh b/test/4-describe-string-import-paths.sh new file mode 100755 index 0000000..c2a3f23 --- /dev/null +++ b/test/4-describe-string-import-paths.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +set -e -o pipefail + +cd "$CURR_DIR"/describe-project + +temp_file=`mktemp` + +function cleanup { + rm $temp_file +} + +trap cleanup EXIT + +if ! $DUB describe --compiler=$COMPILER --string-import-paths > "$temp_file"; then + die 'Printing string import paths failed!' +fi + +# Create the expected output path file to compare against. +echo "$CURR_DIR/describe-project/views/" > "$CURR_DIR/expected-string-import-path-output" +echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$CURR_DIR/expected-string-import-path-output" +echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$CURR_DIR/expected-string-import-path-output" + +if ! diff "$CURR_DIR"/expected-string-import-path-output "$temp_file"; then + die 'The string import paths did not match the expected output!' +fi + diff --git a/test/4-describe-string-importh-paths.sh b/test/4-describe-string-importh-paths.sh deleted file mode 100755 index c2a3f23..0000000 --- a/test/4-describe-string-importh-paths.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -e -o pipefail - -cd "$CURR_DIR"/describe-project - -temp_file=`mktemp` - -function cleanup { - rm $temp_file -} - -trap cleanup EXIT - -if ! $DUB describe --compiler=$COMPILER --string-import-paths > "$temp_file"; then - die 'Printing string import paths failed!' -fi - -# Create the expected output path file to compare against. -echo "$CURR_DIR/describe-project/views/" > "$CURR_DIR/expected-string-import-path-output" -echo "$CURR_DIR/describe-dependency-2/some-extra-string-import-path/" >> "$CURR_DIR/expected-string-import-path-output" -echo "$CURR_DIR/describe-dependency-3/dep3-string-import-path/" >> "$CURR_DIR/expected-string-import-path-output" - -if ! diff "$CURR_DIR"/expected-string-import-path-output "$temp_file"; then - die 'The string import paths did not match the expected output!' -fi -