From 58cd2d5788147c80d6f266b6984615bbd23516d7 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 14 May 2018 19:18:09 +0300 Subject: Add deinit command test --- bdep/config.cxx | 2 +- tests/common.test | 1 + tests/init.test | 28 ++++++++++++++++++++++------ 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 name) + optional& 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. -- cgit v1.1