From ed437dbd3483baa3d15d1d86d8f057d9112653b1 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 14 Aug 2019 14:36:44 +0300 Subject: Add support for default options files --- tests/rep-create.testscript | 17 +++++++++++++++++ tests/rep-info.testscript | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'tests') diff --git a/tests/rep-create.testscript b/tests/rep-create.testscript index 487acf0..a7b9e19 100644 --- a/tests/rep-create.testscript +++ b/tests/rep-create.testscript @@ -147,6 +147,23 @@ EOO } + : remote-key-option-failure + : + : Test that bpkg-rep-create fails for the remote --key option. + : + { + $clone_rep; + + touch .git; # Pretend we are in the git repository. + + mkdir .build2; + echo "--key $key" >=.build2/bpkg-rep-create.options; + + $* 1/stable/ 2>>/~%EOE% != 0 + %.+/bpkg-rep-create.options: error: --key in remote default options file% + EOE + } + : without-key : $clone_rep; diff --git a/tests/rep-info.testscript b/tests/rep-info.testscript index 822dada..ed1f1d3 100644 --- a/tests/rep-info.testscript +++ b/tests/rep-info.testscript @@ -353,3 +353,48 @@ else %fragment: \.+% EOO } + +: default-options-files +: +{ + : specified-dir + : + { + $cfg_create -d cfg 2>! &cfg/***; + + mkdir cfg/.build2; + + echo '--directory .' >= cfg/.build2/bpkg-rep-info.options; + + $* $rep/testing -d cfg 2>>/~%EOE%d != 0; + %\.+/specified-dir/cfg/.build2/bpkg-rep-info.options: error: --directory\|-d in default options file% + EOE + + # Disable default options files loading. + # + $* --no-default-options --name $rep/testing -d cfg >>"EOO" + pkg:build2.org/rep-info/testing ($rep/testing) + EOO + } + + : current-dir + : + { + mkdir .bpkg; # Pretend we are in the configuration directory. + mkdir .build2; + + echo '--directory .' >= .build2/bpkg-rep-info.options; + + # Load options from the current (configuration) directory. + # + $* $rep/testing 2>>/~%EOE%d != 0; + %\.+/current-dir/.build2/bpkg-rep-info.options: error: --directory\|-d in default options file% + EOE + + # Disable loading options from the current (configuration) directory. + # + $* --name -d '' $rep/testing >>"EOO" + pkg:build2.org/rep-info/testing ($rep/testing) + EOO + } +} -- cgit v1.1