diff mbox series

[v3,23/35] userdiff tests: move perl tests to perl.sh

Message ID 20210224195129.4004-24-avarab@gmail.com (mailing list archive)
State New
Headers show
Series userdiff: refactor + test + doc + misc improvements | expand

Commit Message

Ævar Arnfjörð Bjarmason Feb. 24, 2021, 7:51 p.m. UTC
Move the perl tests to perl.sh, a follow-up change will piggy-back on
these tests for updating the userdiff documentation. This will require
the new test *.sh test framework.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t4018/perl-skip-end-of-heredoc     |  9 ----
 t/t4018/perl-skip-forward-decl       | 11 ----
 t/t4018/perl-skip-sub-in-pod         | 19 -------
 t/t4018/perl-sub-definition          |  5 --
 t/t4018/perl-sub-definition-kr-brace |  5 --
 t/t4018/perl.sh                      | 78 ++++++++++++++++++++++++++++
 6 files changed, 78 insertions(+), 49 deletions(-)
 delete mode 100644 t/t4018/perl-skip-end-of-heredoc
 delete mode 100644 t/t4018/perl-skip-forward-decl
 delete mode 100644 t/t4018/perl-skip-sub-in-pod
 delete mode 100644 t/t4018/perl-sub-definition
 delete mode 100644 t/t4018/perl-sub-definition-kr-brace
 create mode 100755 t/t4018/perl.sh
diff mbox series

Patch

diff --git a/t/t4018/perl-skip-end-of-heredoc b/t/t4018/perl-skip-end-of-heredoc
deleted file mode 100644
index 8f90cca7314..00000000000
--- a/t/t4018/perl-skip-end-of-heredoc
+++ /dev/null
@@ -1,9 +0,0 @@ 
-t4018 header: sub RIGHTwithheredocument {
-sub RIGHTwithheredocument {
-	print <<"EOF"
-decoy here-doc
-EOF
-	# some lines of context
-	# to pad it out
-	print "ChangeMe\n";
-}
diff --git a/t/t4018/perl-skip-forward-decl b/t/t4018/perl-skip-forward-decl
deleted file mode 100644
index ff1f6d14735..00000000000
--- a/t/t4018/perl-skip-forward-decl
+++ /dev/null
@@ -1,11 +0,0 @@ 
-t4018 header: package RIGHT;
-package RIGHT;
-
-use strict;
-use warnings;
-use parent qw(Exporter);
-our @EXPORT_OK = qw(round finalround);
-
-sub other; # forward declaration
-
-# ChangeMe
diff --git a/t/t4018/perl-skip-sub-in-pod b/t/t4018/perl-skip-sub-in-pod
deleted file mode 100644
index ff1c65b28fc..00000000000
--- a/t/t4018/perl-skip-sub-in-pod
+++ /dev/null
@@ -1,19 +0,0 @@ 
-t4018 header: =head1 SYNOPSIS_RIGHT
-=head1 NAME
-
-Beer - subroutine to output fragment of a drinking song
-
-=head1 SYNOPSIS_RIGHT
-
-	use Beer qw(round finalround);
-
-	sub song {
-		for (my $i = 99; $i > 0; $i--) {
-			round $i;
-		}
-		finalround;
-	}
-
-	ChangeMe;
-
-=cut
diff --git a/t/t4018/perl-sub-definition b/t/t4018/perl-sub-definition
deleted file mode 100644
index 22e16ad5363..00000000000
--- a/t/t4018/perl-sub-definition
+++ /dev/null
@@ -1,5 +0,0 @@ 
-t4018 header: sub RIGHT {
-sub RIGHT {
-	my ($n) = @_;
-	print "ChangeMe";
-}
diff --git a/t/t4018/perl-sub-definition-kr-brace b/t/t4018/perl-sub-definition-kr-brace
deleted file mode 100644
index 6c94e6a62dd..00000000000
--- a/t/t4018/perl-sub-definition-kr-brace
+++ /dev/null
@@ -1,5 +0,0 @@ 
-t4018 header: sub RIGHT
-sub RIGHT
-{
-	print "ChangeMe\n";
-}
diff --git a/t/t4018/perl.sh b/t/t4018/perl.sh
new file mode 100755
index 00000000000..ac8fff7417a
--- /dev/null
+++ b/t/t4018/perl.sh
@@ -0,0 +1,78 @@ 
+#!/bin/sh
+#
+# See ../t4018-diff-funcname.sh's test_diff_funcname()
+#
+
+test_diff_funcname 'perl: skip end of heredoc' \
+	8<<\EOF_HUNK 9<<\EOF_TEST
+sub RIGHTwithheredocument {
+EOF_HUNK
+sub RIGHTwithheredocument {
+	print <<"EOF"
+decoy here-doc
+EOF
+	# some lines of context
+	# to pad it out
+	print "ChangeMe\n";
+}
+EOF_TEST
+
+test_diff_funcname 'perl: skip forward decl' \
+	8<<\EOF_HUNK 9<<\EOF_TEST
+package RIGHT;
+EOF_HUNK
+package RIGHT;
+
+use strict;
+use warnings;
+use parent qw(Exporter);
+our @EXPORT_OK = qw(round finalround);
+
+sub other; # forward declaration
+
+# ChangeMe
+EOF_TEST
+
+test_diff_funcname 'perl: skip sub in pod' \
+	8<<\EOF_HUNK 9<<\EOF_TEST
+=head1 SYNOPSIS_RIGHT
+EOF_HUNK
+=head1 NAME
+
+Beer - subroutine to output fragment of a drinking song
+
+=head1 SYNOPSIS_RIGHT
+
+	use Beer qw(round finalround);
+
+	sub song {
+		for (my $i = 99; $i > 0; $i--) {
+			round $i;
+		}
+		finalround;
+	}
+
+	ChangeMe;
+
+=cut
+EOF_TEST
+
+test_diff_funcname 'perl: sub definition' \
+	8<<\EOF_HUNK 9<<\EOF_TEST
+sub RIGHT {
+EOF_HUNK
+sub RIGHT {
+	my ($n) = @_;
+	print "ChangeMe";
+}
+EOF_TEST
+
+test_diff_funcname 'perl: sub definition kr brace' \
+	8<<\EOF_HUNK 9<<\EOF_TEST
+sub RIGHT
+EOF_HUNK
+sub RIGHT
+{
+	print "ChangeMe\n";
+}
+EOF_TEST