diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-08-13 14:10:48 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-08-13 16:52:22 +0300 |
commit | 5f571ad3cc75d35a8259ca6a3d5d78b6ee62d137 (patch) | |
tree | dc5e2bf437766d8d7042252486d23678bdae07f7 /tests | |
parent | edab35e216bc3839915129e54f98160428634283 (diff) |
Add --pre-hook option to bdep-new
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 |