diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/new.testscript | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/tests/new.testscript b/tests/new.testscript index 9ac0b9f..3c39b47 100644 --- a/tests/new.testscript +++ b/tests/new.testscript @@ -704,7 +704,7 @@ status += -d prj : default-options-files : { - : remote-post-hook + : remote-hooks : if $posix { @@ -713,15 +713,32 @@ status += -d prj mkdir prj/.build2; cat <<EOI >=prj/.build2/bdep-new-package.options; - --post-hook "echo .idea/ >>.gitignore" + --pre-hook "mv .gitignore .gitignore.bak" + --post-hook "cat .gitignore.bak >>.gitignore" + --post-hook "rm .gitignore.bak" + EOI + + mkdir --no-cleanup prj/libprj; + + cat <<EOI >=prj/libprj/.gitignore; + CMakeCache.txt EOI $* --package -t lib -d prj libprj <'y' 2>>~%EOE%; - remote post-creation hooks: - % .+/.build2/bdep-new-package.options: echo .idea/ >>.gitignore% + %remote hook commands in .+/.build2/bdep-new-package.options:% + pre: mv .gitignore .gitignore.bak + post: cat .gitignore.bak >>.gitignore + post: rm .gitignore.bak %execute\? \[y/n\] created new library package libprj in .+/prj/libprj/% EOE + cat prj/libprj/.gitignore >>~%EOO%; + # Compiler/linker output. + # + %.+ + CMakeCache.txt + EOO + $build prj/libprj/ $cxx 2>>~%EOE% %(version\.in|c\+\+|ar|ld) .+%{7} EOE @@ -826,6 +843,43 @@ status += -d prj EOE } } + + : pre-hook + : + if $posix + { + : success + : + { + mkdir --no-cleanup prj &prj/***; + + cat <<EOI >=prj/.gitignore; + CMakeCache.txt + EOI + + $* prj --pre-hook "mv .gitignore .gitignore.bak" \ + --post-hook "cat .gitignore.bak >>.gitignore" \ + --post-hook "rm .gitignore.bak" 2>>/"EOE"; + created new executable project prj in $~/prj/ + EOE + + cat prj/.gitignore >>~%EOO% + .bdep/ + %.+ + CMakeCache.txt + EOO + } + + : failure + : + { + : substitution + : + $* prj --pre-hook 'echo foo >>@bar@' 2>>EOE &prj/*** != 0 + error: invalid pre hook 'echo foo >>@bar@': unknown variable 'bar' + EOE + } + } } : cfg |