"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog: basic diff regress
To:
Game of Trees <gameoftrees@openbsd.org>
Date:
Sat, 15 Apr 2023 14:35:59 +1000

Download raw body.

Thread
On 23-04-14 06:37PM, Stefan Sperling wrote:
> On Sat, Apr 15, 2023 at 02:11:58AM +1000, Mark Jamsek wrote:
> > On 23-04-15 02:05AM, Mark Jamsek wrote:
> > > On 23-04-15 02:02AM, Mark Jamsek wrote:
> > > > On 23-04-15 02:00AM, Mark Jamsek wrote:
> > > > > The below diff adds two basic tog diff tests: one for contiguous (direct
> > > > > parent/child 'tog diff parent child') commits; and another for arbitrary
> > > > > commits.
> > > > 
> > > > Ignore previous, below fixes some 'log' copypasta.
> > > 
> > > Ah! Ignore both for the time being :)
> > 
> > This fixes the silly error for the moment so you can at least run the
> > basic diff tests (and review as they won't functionally change). But I'm
> > not entirely happy with how we set the script envvar as I want that to
> > be really simple so I will revisit that tomorrow after some zzz.
> 
> Well, it seems alright to me and it works.
> You could always layer more tweaks on top.

Thanks, stsp!

The below diff applies on top, and makes $testname global so we can use
that for each test script path. The objective is to minimise repeated
copypasta errors. With this, if a new test is written that copypastas an
existing similar one as a template, we don't have to worry about
changing the script path each time. What do you think?

diff /home/mark/src/got
commit - 5917df30116cd6abd6b35e9a3b05bbdabc1eadf6
path + /home/mark/src/got
blob - 5d1923c4ca2250970b43c75113fe698afc43c8fa
file + regress/tog/common.sh
--- regress/tog/common.sh
+++ regress/tog/common.sh
@@ -76,7 +76,7 @@ test_init()
 
 test_init()
 {
-	local testname="$1"
+	testname="$1"
 	local columns="$2"
 	local lines="$3"
 	local no_tree="$4"
blob - 902869a9ca413b91478973db6d9a321762064b65
file + regress/tog/diff.sh
--- regress/tog/diff.sh
+++ regress/tog/diff.sh
@@ -31,7 +31,7 @@ test_diff_contiguous_commits()
 	local head_id_truncated=`trim_obj_id 13 $head_id`
 	local alpha_id=`get_blob_id $testroot/repo "" alpha`
 
-	cat <<EOF >$testroot/diff_contiguous_commits
+	cat <<EOF >$testroot/$testname
 SCREENDUMP
 EOF
 
@@ -94,7 +94,7 @@ test_diff_arbitrary_commits()
 	local alpha_id=`get_blob_id $testroot/repo "" alpha`
 	local new_id=`get_blob_id $testroot/repo "" new`
 
-	cat <<EOF >$testroot/diff_arbitrary_commits
+	cat <<EOF >$testroot/$testname
 SCREENDUMP
 EOF
 
blob - ebe153cb83ffd423e6db29b48c099f17ed6acdc9
file + regress/tog/log.sh
--- regress/tog/log.sh
+++ regress/tog/log.sh
@@ -25,7 +25,7 @@ test_log_hsplit_diff()
 	local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	local ymd=`date -u -r $author_time +"%G-%m-%d"`
 
-	cat <<EOF >$testroot/log_hsplit_diff
+	cat <<EOF >$testroot/$testname
 KEY_ENTER	open diff view of selected commit
 S		toggle horizontal split
 SCREENDUMP
@@ -82,7 +82,7 @@ test_log_vsplit_diff()
 	local blobid_alpha=`get_blob_id $testroot/repo "" alpha`
 	local blobid_beta=`get_blob_id $testroot/repo "" beta`
 
-	cat <<EOF >$testroot/log_vsplit_diff
+	cat <<EOF >$testroot/$testname
 KEY_ENTER	open diff view of selected commit in vertical split
 SCREENDUMP
 EOF
@@ -146,7 +146,7 @@ test_log_show_author()
 	local commit1=`git_show_head $testroot/repo`
 	local id1_len8=`trim_obj_id 32 $commit1`
 
-	cat <<EOF >$testroot/log_show_author
+	cat <<EOF >$testroot/$testname
 @		toggle show author
 SCREENDUMP
 EOF
@@ -186,7 +186,7 @@ test_log_scroll_right()
 
 	local commit1=`git_show_head $testroot/repo`
 
-	cat <<EOF >$testroot/log_scroll_right
+	cat <<EOF >$testroot/$testname
 l		scroll right
 l		scroll right
 SCREENDUMP
@@ -219,7 +219,7 @@ test_log_hsplit_ref()
 	local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	local ymd=`date -u -r $author_time +"%G-%m-%d"`
 
-	cat <<EOF >$testroot/log_hsplit_ref
+	cat <<EOF >$testroot/$testname
 R		open ref view
 S		toggle horizontal split
 -		reduce size of ref view split
@@ -260,7 +260,7 @@ test_log_hsplit_tree()
 	local date=`date -u -r $author_time +"%a %b %e %X %Y UTC"`
 	local ymd=`date -u -r $author_time +"%G-%m-%d"`
 
-	cat <<EOF >$testroot/log_hsplit_tree
+	cat <<EOF >$testroot/$testname
 T		open tree view
 S		toggle horizontal split
 j		move selection cursor down one entry to "beta"
@@ -306,7 +306,7 @@ test_log_logmsg_widechar()
 	local commit1=`git_show_parent_commit $testroot/repo`
 	local blobid=`get_blob_id $testroot/repo "" $(widechar_filename)`
 
-	cat <<EOF >$testroot/log_logmsg_widechar
+	cat <<EOF >$testroot/$testname
 KEY_ENTER	open selected commit in diff view
 F		toggle fullscreen
 SCREENDUMP

-- 
Mark Jamsek <fnc.bsdbox.org|got.bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68