[PATCH v3 15/35] userdiff tests: add a test with multiple tests in a LANG file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Demonstrate that we can now have tests with multiple tests in a given
LANG file. This is useful to show rules that don't match, follow-up
commits will add some tests like that.

Let's move the "golang" test, which I'm going to be modifying soon
over to to this new convention.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/t4018-diff-funcname.sh        |  2 +-
 t/t4018/README                  |  8 +++++++
 t/t4018/golang                  | 39 +++++++++++++++++++++++++++++++++
 t/t4018/golang-complex-function |  9 --------
 t/t4018/golang-func             |  5 -----
 t/t4018/golang-interface        |  5 -----
 t/t4018/golang-long-func        |  6 -----
 t/t4018/golang-struct           |  5 -----
 8 files changed, 48 insertions(+), 31 deletions(-)
 create mode 100644 t/t4018/golang
 delete mode 100644 t/t4018/golang-complex-function
 delete mode 100644 t/t4018/golang-func
 delete mode 100644 t/t4018/golang-interface
 delete mode 100644 t/t4018/golang-long-func
 delete mode 100644 t/t4018/golang-struct

diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh
index 6fd3dce1364..7fc4291f4be 100755
--- a/t/t4018-diff-funcname.sh
+++ b/t/t4018-diff-funcname.sh
@@ -67,7 +67,7 @@ test_expect_success 'last regexp must not be negated' '
 test_expect_success 'setup hunk header tests' '
 	for i in $diffpatterns
 	do
-		echo "$i-* diff=$i"
+		echo "$i* diff=$i"
 	done > .gitattributes &&
 
 	cp -R "$TEST_DIRECTORY"/t4018 . &&
diff --git a/t/t4018/README b/t/t4018/README
index 54ae735d5f8..a3220dd6374 100644
--- a/t/t4018/README
+++ b/t/t4018/README
@@ -41,6 +41,9 @@ below) are:
 Create test cases called "LANG-whatever" in this directory, where
 "whatever" is a brief description of the test.
 
+You can also stick all the tests into one "LANG" file. See "t4018
+description" below.
+
 Any line starting with "t4018" is a control line for the test:
 
  - The "t4018 header:" line above specifies what text must appear in
@@ -48,6 +51,11 @@ Any line starting with "t4018" is a control line for the test:
    the line for ease of not having to hardcode the line numbers and
    offsets.
 
+ - The "t4018 description:" line above the test is a convention to add
+   a human-readable description for the test. Unlike in the case of
+   the LANG.sh test cases these descriptions don't make it to
+   "test_expect_success", and won't be seen in the test output.
+
 In many of the test cases the header line includes the token "RIGHT",
 this used to be part of the test syntax, but isn't anymore. Now we
 care about the "t4018 header:" line, not whatever line contains a
diff --git a/t/t4018/golang b/t/t4018/golang
new file mode 100644
index 00000000000..000e66b1c7b
--- /dev/null
+++ b/t/t4018/golang
@@ -0,0 +1,39 @@
+t4018 description: complex function
+t4018 header: func (t *Test) RIGHT(a Type) (Type, error) {
+type Test struct {
+	a Type
+}
+
+func (t *Test) RIGHT(a Type) (Type, error) {
+	t.a = a
+	return ChangeMe, nil
+}
+
+t4018 description: func
+t4018 header: func RIGHT() {
+func RIGHT() {
+	a := 5
+	b := ChangeMe
+}
+
+t4018 description: interface
+t4018 header: type RIGHT interface {
+type RIGHT interface {
+	a() Type
+	b() ChangeMe
+}
+
+t4018 description: long func
+t4018 header: func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
+func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
+	anotherLongVariableName AnotherLongType) {
+	a := 5
+	b := ChangeMe
+}
+
+t4018 description: struct
+t4018 header: type RIGHT struct {
+type RIGHT struct {
+	a Type
+	b ChangeMe
+}
diff --git a/t/t4018/golang-complex-function b/t/t4018/golang-complex-function
deleted file mode 100644
index 0574ba912e6..00000000000
--- a/t/t4018/golang-complex-function
+++ /dev/null
@@ -1,9 +0,0 @@
-t4018 header: func (t *Test) RIGHT(a Type) (Type, error) {
-type Test struct {
-	a Type
-}
-
-func (t *Test) RIGHT(a Type) (Type, error) {
-	t.a = a
-	return ChangeMe, nil
-}
diff --git a/t/t4018/golang-func b/t/t4018/golang-func
deleted file mode 100644
index 0472cfd9798..00000000000
--- a/t/t4018/golang-func
+++ /dev/null
@@ -1,5 +0,0 @@
-t4018 header: func RIGHT() {
-func RIGHT() {
-	a := 5
-	b := ChangeMe
-}
diff --git a/t/t4018/golang-interface b/t/t4018/golang-interface
deleted file mode 100644
index 3160a1d4524..00000000000
--- a/t/t4018/golang-interface
+++ /dev/null
@@ -1,5 +0,0 @@
-t4018 header: type RIGHT interface {
-type RIGHT interface {
-	a() Type
-	b() ChangeMe
-}
diff --git a/t/t4018/golang-long-func b/t/t4018/golang-long-func
deleted file mode 100644
index de83aaafca5..00000000000
--- a/t/t4018/golang-long-func
+++ /dev/null
@@ -1,6 +0,0 @@
-t4018 header: func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
-func RIGHT(aVeryVeryVeryLongVariableName AVeryVeryVeryLongType,
-	anotherLongVariableName AnotherLongType) {
-	a := 5
-	b := ChangeMe
-}
diff --git a/t/t4018/golang-struct b/t/t4018/golang-struct
deleted file mode 100644
index fc8022537b2..00000000000
--- a/t/t4018/golang-struct
+++ /dev/null
@@ -1,5 +0,0 @@
-t4018 header: type RIGHT struct {
-type RIGHT struct {
-	a Type
-	b ChangeMe
-}
-- 
2.30.0.284.gd98b1dd5eaa7




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux