From 950f90c24d818782a88c612cb24845b8086a281f Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 4 Jul 2018 01:54:13 +0100 Subject: test suite: checkout: new test Signed-off-by: Ian Jackson --- tests/tests/checkout | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 tests/tests/checkout (limited to 'tests/tests/checkout') diff --git a/tests/tests/checkout b/tests/tests/checkout new file mode 100755 index 0000000..4b205f3 --- /dev/null +++ b/tests/tests/checkout @@ -0,0 +1,49 @@ +#!/bin/bash +set -e +. tests/lib +t-tstunt-parsechangelog + +t-setup-import examplegit + +p=example + +mkdir $p.2 +cd $p.2 + +git init +t-dgit setup-new-tree +t-dgit checkout -p $p unstable + +t-refs-same-start +t-ref-head +t-ref-same refs/tags/test-dummy/$v + +t-dgit checkout -p $p stable + +t-dgit checkout -d no-such-distro sid +t-ref-head + +t-dgit checkout stable + +git branch -D dgit/sid +t-dgit checkout -d no-such-distro sid +t-ref-head + +git reflog --pretty=tformat:%gs >../reflog.got +cat >../reflog.expect <../refs.got +cat >../refs.expect < Date: Thu, 5 Jul 2018 00:15:44 +0100 Subject: test suite: Always pass LC_COLLATE=C to sort(1). Specifically, by replacing every invocation of sort with the new function t-sort. The one case where we already took care of this, we change LC_ALL to LC_COLLATE, which should be sufficient. Closes:#903006. Signed-off-by: Ian Jackson --- tests/tests/checkout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/tests/checkout') diff --git a/tests/tests/checkout b/tests/tests/checkout index 4b205f3..bc3d6ef 100755 --- a/tests/tests/checkout +++ b/tests/tests/checkout @@ -39,7 +39,7 @@ dgit checkout unstable END diff -u ../reflog.{expect,got} -git for-each-ref --format='%(refname)' refs/heads | sort >../refs.got +git for-each-ref --format='%(refname)' refs/heads | t-sort >../refs.got cat >../refs.expect < Date: Thu, 5 Jul 2018 00:56:36 +0100 Subject: test suite: checkout: Check we end up on the right branch each time Signed-off-by: Ian Jackson --- tests/tests/checkout | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/tests/checkout') diff --git a/tests/tests/checkout b/tests/tests/checkout index bc3d6ef..756c49b 100755 --- a/tests/tests/checkout +++ b/tests/tests/checkout @@ -5,6 +5,11 @@ t-tstunt-parsechangelog t-setup-import examplegit +now-on () { + local branch=$(git symbolic-ref HEAD) + test "$branch" = "refs/heads/$1" +} + p=example mkdir $p.2 @@ -14,20 +19,25 @@ git init t-dgit setup-new-tree t-dgit checkout -p $p unstable +now-on dgit/sid t-refs-same-start t-ref-head t-ref-same refs/tags/test-dummy/$v t-dgit checkout -p $p stable +now-on dgit/stable t-dgit checkout -d no-such-distro sid t-ref-head +now-on dgit/sid t-dgit checkout stable +now-on dgit/stable git branch -D dgit/sid t-dgit checkout -d no-such-distro sid t-ref-head +now-on dgit/sid git reflog --pretty=tformat:%gs >../reflog.got cat >../reflog.expect <