From ad9dfed79c4b8319d2e68db8c08f531d4f8e53b0 Mon Sep 17 00:00:00 2001 From: VasilevNStas Date: Mon, 10 Aug 2026 17:07:34 +0300 Subject: [PATCH 1/3] feat(#553): add test-word lint --- .../org/eolang/lints/tests/test-word.xsl | 38 +++++++++++++++++++ .../org/eolang/motives/tests/test-word.md | 26 +++++++++++++ .../test-word/allows-clean-test-names.yaml | 16 ++++++++ .../allows-test-word-in-regular-object.yaml | 14 +++++++ .../catches-test-in-nested-object.yaml | 17 +++++++++ .../catches-test-in-test-object.yaml | 17 +++++++++ .../catches-test-word-in-helper.yaml | 17 +++++++++ 7 files changed, 145 insertions(+) create mode 100644 src/main/resources/org/eolang/lints/tests/test-word.xsl create mode 100644 src/main/resources/org/eolang/motives/tests/test-word.md create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml create mode 100644 src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml diff --git a/src/main/resources/org/eolang/lints/tests/test-word.xsl b/src/main/resources/org/eolang/lints/tests/test-word.xsl new file mode 100644 index 000000000..80dd521d1 --- /dev/null +++ b/src/main/resources/org/eolang/lints/tests/test-word.xsl @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + warning + + The name of the object + + must not contain the word 'test' + + + + + + diff --git a/src/main/resources/org/eolang/motives/tests/test-word.md b/src/main/resources/org/eolang/motives/tests/test-word.md new file mode 100644 index 000000000..b32615a0c --- /dev/null +++ b/src/main/resources/org/eolang/motives/tests/test-word.md @@ -0,0 +1,26 @@ +# Test word + +Names of objects in test files must not contain the word 'test'. If an object +is a unit test, or a helper inside a unit test, or lives in a file whose top +object name ends with `-tests`, its name should describe the behavior it +verifies instead of repeating the word 'test'. + +Incorrect: + +```eo +# Tests for foo. +[] > foo-tests + # Test. + [] +> can-test-add + 42 > @ +``` + +Correct: + +```eo +# Tests for foo. +[] > foo-tests + # Test. + [] +> can-add-two-and-two + 42 > @ +``` diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml new file mode 100644 index 000000000..f49e87597 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-word.xsl +asserts: + - /defects[count(defect[@severity='warning'])=0] +ignore-schema: true +document: | + + + + + + + diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml new file mode 100644 index 000000000..66a182bc1 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-word.xsl +asserts: + - /defects[count(defect[@severity='warning'])=0] +ignore-schema: true +document: | + + + + + diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml new file mode 100644 index 000000000..320ad5127 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-word.xsl +asserts: + - /defects[count(defect[@severity='warning'])=1] + - /defects/defect[@line='5'] +ignore-schema: true +document: | + + + + + + + diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml new file mode 100644 index 000000000..30947499e --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-word.xsl +asserts: + - /defects[count(defect[@severity='warning'])=1] + - /defects/defect[@line='3'] +ignore-schema: true +document: | + + + + + + + diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml new file mode 100644 index 000000000..e3c84dc46 --- /dev/null +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml @@ -0,0 +1,17 @@ +# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com +# SPDX-License-Identifier: MIT +--- +sheets: + - /org/eolang/lints/tests/test-word.xsl +asserts: + - /defects[count(defect[@severity='warning'])=1] + - /defects/defect[@line='5'] +ignore-schema: true +document: | + + + + + + + From 764b5a1ce2028e7ba2dd75c5bd4d7407a9ee7c5f Mon Sep 17 00:00:00 2001 From: VasilevNStas Date: Fri, 21 Aug 2026 00:00:29 +0300 Subject: [PATCH 2/3] fix(#553): use EO packs for test-word per review --- .../test-word/allows-clean-test-names.yaml | 14 +++++--------- .../allows-test-word-in-regular-object.yaml | 12 +++++------- .../catches-test-in-nested-object.yaml | 17 +++++++---------- .../test-word/catches-test-in-test-object.yaml | 14 +++++--------- .../test-word/catches-test-word-in-helper.yaml | 17 +++++++---------- 5 files changed, 29 insertions(+), 45 deletions(-) diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml index f49e87597..7a590f285 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-clean-test-names.yaml @@ -5,12 +5,8 @@ sheets: - /org/eolang/lints/tests/test-word.xsl asserts: - /defects[count(defect[@severity='warning'])=0] -ignore-schema: true -document: | - - - - - - - +input: | + [] > foo-tests + + [] +> can-add + 42 > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml index 66a182bc1..647c57a59 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml @@ -5,10 +5,8 @@ sheets: - /org/eolang/lints/tests/test-word.xsl asserts: - /defects[count(defect[@severity='warning'])=0] -ignore-schema: true -document: | - - - - - +input: | + [] > app + + testing-helper > testing-helper + TRUE > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml index 320ad5127..edaa31153 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-nested-object.yaml @@ -5,13 +5,10 @@ sheets: - /org/eolang/lints/tests/test-word.xsl asserts: - /defects[count(defect[@severity='warning'])=1] - - /defects/defect[@line='5'] -ignore-schema: true -document: | - - - - - - - + - /defects/defect[@line='4'] +input: | + [] > foo-tests + + [] +> can-setup + tests-helper > tests-helper + 42 > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml index 30947499e..47cdea37d 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-in-test-object.yaml @@ -6,12 +6,8 @@ sheets: asserts: - /defects[count(defect[@severity='warning'])=1] - /defects/defect[@line='3'] -ignore-schema: true -document: | - - - - - - - +input: | + [] > foo-tests + + [] +> can-test-add + 42 > @ diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml index e3c84dc46..8676d8f90 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/catches-test-word-in-helper.yaml @@ -5,13 +5,10 @@ sheets: - /org/eolang/lints/tests/test-word.xsl asserts: - /defects[count(defect[@severity='warning'])=1] - - /defects/defect[@line='5'] -ignore-schema: true -document: | - - - - - - - + - /defects/defect[@line='4'] +input: | + [] > foo-tests + + [] > can-run + tests-helper > tests-helper + 42 > @ From 8891d4a7b0242a5928777fd5f8baea303b9780bd Mon Sep 17 00:00:00 2001 From: VasilevNStas Date: Fri, 21 Aug 2026 08:30:50 +0300 Subject: [PATCH 3/3] fix(#553): drop blank line before plain object per R-6.5.4 --- .../single/test-word/allows-test-word-in-regular-object.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml index 647c57a59..2c01ab4b3 100644 --- a/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml +++ b/src/test/resources/org/eolang/lints/packs/single/test-word/allows-test-word-in-regular-object.yaml @@ -7,6 +7,5 @@ asserts: - /defects[count(defect[@severity='warning'])=0] input: | [] > app - testing-helper > testing-helper - TRUE > @ + 42 > @