aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-05-14 19:18:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-14 19:18:09 +0300
commit58cd2d5788147c80d6f266b6984615bbd23516d7 (patch)
treefc8c25816553361390b435db1c9fab0eed84420b
parentcbd7cabcc3e6b24e80521bfec230e905f420ff4f (diff)
Add deinit command test
-rw-r--r--bdep/config.cxx2
-rw-r--r--tests/common.test1
-rw-r--r--tests/init.test28
3 files changed, 24 insertions, 7 deletions
diff --git a/bdep/config.cxx b/bdep/config.cxx
index 70441cc..e75b817 100644
--- a/bdep/config.cxx
+++ b/bdep/config.cxx
@@ -18,7 +18,7 @@ namespace bdep
static inline void
translate_path_name (const dir_path& prj,
dir_path& path,
- optional<string> name)
+ optional<string>& name)
{
if (name || !path.simple () || path.string ().front () != '@')
return;
diff --git a/tests/common.test b/tests/common.test
index 8e83b23..f66d9eb 100644
--- a/tests/common.test
+++ b/tests/common.test
@@ -26,6 +26,7 @@ status = $* status
init = $* init
sync = $* sync
fetch = $* fetch
+deinit = $* deinit
# All testscripts are named after bdep commands, for example sync.test. So the
# testscript scope id is a name of the command being tested.
diff --git a/tests/init.test b/tests/init.test
index 0200277..43ce441 100644
--- a/tests/init.test
+++ b/tests/init.test
@@ -2,12 +2,16 @@
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
+# Here we test both init and deinit commands.
+#
+
.include common.test project.test
new += 2>!
status += --all
+deinit += -d prj
-test.cleanups += &prj/build/bootstrap/*** &?prj-cfg/***
+cxx = cc "config.cxx=$config.cxx"
: cfg-create
:
@@ -17,7 +21,7 @@ test.cleanups += &prj/build/bootstrap/*** &?prj-cfg/***
{
$clone_prj;
- $* -C prj-cfg @cfg cc "config.cxx=$config.cxx" 'config.cc.poptions=-DTEST' 2>>/~"%EOE%";
+ $* -C @cfg $cxx 'config.cc.poptions=-DTEST' 2>>/~"%EOE%" &prj-cfg/***;
initializing in project $~/prj/
created configuration @cfg $~/prj-cfg/ \(1, default, forwarded, auto-synchronized\)
synchronizing:
@@ -36,22 +40,28 @@ test.cleanups += &prj/build/bootstrap/*** &?prj-cfg/***
ln prj-cfg/prj/prj/exe{prj} -> prj/prj/
EOE
- $build prj-cfg/ 2>>/EOE
+ $build prj-cfg/ 2>>/EOE;
info: dir{prj-cfg/} is up to date
EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ synchronizing:
+ drop prj
+ EOE
}
: cfg-add
:
{
- create_cfg = $bpkg create cc "config.cxx=$config.cxx" -d 2>!
+ create_cfg = $bpkg create $cxx -d 2>!
$clone_prj;
$create_cfg prj-cfg1/ &prj-cfg1/***;
$create_cfg prj-cfg2/ &prj-cfg2/***;
- $* -A prj-cfg1 @cfg1 2>>/~"%EOE%";
+ $* -A @cfg1 2>>/~"%EOE%";
initializing in project $~/prj/
added configuration @cfg1 $~/prj-cfg1/ \(1, default, forwarded, auto-synchronized\)
synchronizing:
@@ -85,10 +95,16 @@ test.cleanups += &prj/build/bootstrap/*** &?prj-cfg/***
ld prj-cfg2/prj/prj/exe{prj}
EOE
- $build prj/ 2>>/EOE &prj/prj/prj$exe
+ $build prj/ 2>>/EOE &prj/prj/prj$exe;
ln prj-cfg1/prj/prj/exe{prj} -> prj/prj/
info: prj-cfg1/dir{prj/} is up to date
EOE
+
+ $deinit 2>>/"EOE"
+ deinitializing in project $~/prj/
+ synchronizing:
+ drop prj
+ EOE
}
# @@ Test initializing a package rather than project.