Skip to content

Commit 0a5e52d

Browse files
authored
Merge pull request #273 from h1alexbel/272
bug(#272): `incorrect-test-object-name` allows one-letter-parts
2 parents 11d6464 + e59ed12 commit 0a5e52d

File tree

5 files changed

+100
-5
lines changed

5 files changed

+100
-5
lines changed

src/main/resources/org/eolang/lints/misc/incorrect-test-object-name.xsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ SOFTWARE.
3030
<xsl:template match="/">
3131
<defects>
3232
<xsl:for-each select="/program[metas/meta[head='tests']]/objects/o[@name]">
33-
<xsl:variable name="regexp" select="'^[a-z][a-z0-9]+(-[a-z0-9][a-z0-9]+)*$'"/>
33+
<xsl:variable name="regexp" select="'^[a-z][a-z0-9]*(-[a-z0-9]+)*$'"/>
3434
<xsl:if test="not(matches(@name, $regexp))">
3535
<defect>
3636
<xsl:attribute name="line">

src/test/resources/org/eolang/lints/packs/incorrect-test-object-name/catches-single-character.yaml renamed to src/test/resources/org/eolang/lints/packs/incorrect-test-object-name/allows-many-one-letter-parts.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
sheets:
2424
- /org/eolang/lints/misc/incorrect-test-object-name.xsl
2525
asserts:
26-
- /defects[count(defect[@severity='warning'])=1]
27-
- /defects/defect[@line='4']
26+
- /defects[count(defect[@severity='warning'])=0]
2827
input: |
2928
+tests
3029
3130
# Test.
32-
[] > t
33-
42 > foo
31+
[] > f-o-o
32+
42 > @
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2016-2025 Objectionary.com
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
---
23+
sheets:
24+
- /org/eolang/lints/misc/incorrect-test-object-name.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+tests
29+
30+
# Test.
31+
[] > e-tests-ln-one-is-one
32+
42 > @
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2016-2025 Objectionary.com
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
---
23+
sheets:
24+
- /org/eolang/lints/misc/incorrect-test-object-name.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+tests
29+
30+
# Test.
31+
[] > f-1-runs-from-0-km
32+
42 > @
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# The MIT License (MIT)
2+
#
3+
# Copyright (c) 2016-2025 Objectionary.com
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included
13+
# in all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
# SOFTWARE.
22+
---
23+
sheets:
24+
- /org/eolang/lints/misc/incorrect-test-object-name.xsl
25+
asserts:
26+
- /defects[count(defect[@severity='warning'])=0]
27+
input: |
28+
+tests
29+
30+
# Test.
31+
[] > tests-ln-of-e-one-is-one
32+
42 > @

0 commit comments

Comments
 (0)