Skip to content

Commit 3c3f9ea

Browse files
committed
Review Feedback Vol. 1
1 parent 1920ff3 commit 3c3f9ea

22 files changed

Lines changed: 180 additions & 154 deletions

File tree

spock-specs/src/test/groovy/org/spockframework/smoke/ast/AstSpec.groovy

Lines changed: 0 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -387,158 +387,4 @@ class TestSpec extends Specification {
387387
then:
388388
textSnapshotter.assertThat(result.source).matchesSnapshot()
389389
}
390-
391-
def "GDK method that looks like built-in method as implicit condition"() {
392-
when:
393-
def result = compiler.transpileFeatureBody('''
394-
expect:
395-
null.with {
396-
false
397-
}
398-
''')
399-
400-
then:
401-
snapshotter.assertThat(result.source).matchesSnapshot()
402-
}
403-
404-
def "GDK method that looks like built-in method as explicit condition"() {
405-
when:
406-
def result = compiler.transpileFeatureBody('''
407-
expect:
408-
assert null.with {
409-
false
410-
}
411-
''')
412-
413-
then:
414-
snapshotter.assertThat(result.source).matchesSnapshot()
415-
}
416-
417-
def "condition method #conditionMethod within condition method #conditionMethod"() {
418-
when:
419-
def result = compiler.transpileFeatureBody("""
420-
expect:
421-
$conditionMethod(['']) {
422-
$conditionMethod(['']) {
423-
false
424-
}
425-
}
426-
""")
427-
428-
then:
429-
snapshotter.assertThat(result.source).matchesSnapshot()
430-
431-
where:
432-
conditionMethod << [
433-
'with',
434-
'verifyAll',
435-
'verifyEach'
436-
]
437-
}
438-
439-
def "condition method #conditionMethod within condition method #conditionMethod with exception"() {
440-
when:
441-
def result = compiler.transpileFeatureBody("""
442-
expect:
443-
$conditionMethod(['']) {
444-
$conditionMethod(['']) {
445-
true
446-
throw new Exception('foo')
447-
}
448-
}
449-
""")
450-
451-
then:
452-
snapshotter.assertThat(result.source).matchesSnapshot()
453-
454-
where:
455-
conditionMethod << [
456-
'with',
457-
'verifyAll',
458-
'verifyEach'
459-
]
460-
}
461-
462-
def "condition method #conditionMethod within condition method #conditionMethod with only exception"() {
463-
when:
464-
def result = compiler.transpileFeatureBody("""
465-
expect:
466-
$conditionMethod(['']) {
467-
$conditionMethod(['']) {
468-
throw new Exception('foo')
469-
}
470-
}
471-
""")
472-
473-
then:
474-
snapshotter.assertThat(result.source).matchesSnapshot()
475-
476-
where:
477-
conditionMethod << [
478-
'with',
479-
'verifyAll',
480-
'verifyEach'
481-
]
482-
}
483-
484-
def "condition method #conditionMethod"() {
485-
when:
486-
def result = compiler.transpileFeatureBody("""
487-
expect:
488-
$conditionMethod(['']) {
489-
false
490-
}
491-
""")
492-
493-
then:
494-
snapshotter.assertThat(result.source).matchesSnapshot()
495-
496-
where:
497-
conditionMethod << [
498-
'with',
499-
'verifyAll',
500-
'verifyEach'
501-
]
502-
}
503-
504-
def "condition method #conditionMethod with exception"() {
505-
when:
506-
def result = compiler.transpileFeatureBody("""
507-
expect:
508-
$conditionMethod(['']) {
509-
true
510-
throw new Exception('foo')
511-
}
512-
""")
513-
514-
then:
515-
snapshotter.assertThat(result.source).matchesSnapshot()
516-
517-
where:
518-
conditionMethod << [
519-
'with',
520-
'verifyAll',
521-
'verifyEach'
522-
]
523-
}
524-
525-
def "condition method #conditionMethod with only exception"() {
526-
when:
527-
def result = compiler.transpileFeatureBody("""
528-
expect:
529-
$conditionMethod(['']) {
530-
throw new Exception('foo')
531-
}
532-
""")
533-
534-
then:
535-
snapshotter.assertThat(result.source).matchesSnapshot()
536-
537-
where:
538-
conditionMethod << [
539-
'with',
540-
'verifyAll',
541-
'verifyEach'
542-
]
543-
}
544390
}
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/*
2+
* Copyright 2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* https://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
*
14+
*/
15+
16+
package org.spockframework.smoke.ast.condition
17+
18+
19+
import org.spockframework.EmbeddedSpecification
20+
import org.spockframework.specs.extension.SpockSnapshotter
21+
import spock.lang.Snapshot
22+
23+
class ConditionMethodsAstSpec extends EmbeddedSpecification {
24+
@Snapshot(extension = 'groovy')
25+
SpockSnapshotter snapshotter
26+
27+
def "GDK method that looks like built-in method as implicit condition"() {
28+
when:
29+
def result = compiler.transpileFeatureBody('''
30+
expect:
31+
null.with {
32+
false
33+
}
34+
''')
35+
36+
then:
37+
snapshotter.assertThat(result.source).matchesSnapshot()
38+
}
39+
40+
def "GDK method that looks like built-in method as explicit condition"() {
41+
when:
42+
def result = compiler.transpileFeatureBody('''
43+
expect:
44+
assert null.with {
45+
false
46+
}
47+
''')
48+
49+
then:
50+
snapshotter.assertThat(result.source).matchesSnapshot()
51+
}
52+
53+
def "condition method #conditionMethod within condition method #conditionMethod"() {
54+
when:
55+
def result = compiler.transpileFeatureBody("""
56+
expect:
57+
$conditionMethod(['']) {
58+
$conditionMethod(['']) {
59+
false
60+
}
61+
}
62+
""")
63+
64+
then:
65+
snapshotter.assertThat(result.source).matchesSnapshot()
66+
67+
where:
68+
conditionMethod << [
69+
'with',
70+
'verifyAll',
71+
'verifyEach'
72+
]
73+
}
74+
75+
def "condition method #conditionMethod within condition method #conditionMethod with exception"() {
76+
when:
77+
def result = compiler.transpileFeatureBody("""
78+
expect:
79+
$conditionMethod(['']) {
80+
$conditionMethod(['']) {
81+
true
82+
throw new Exception('foo')
83+
}
84+
}
85+
""")
86+
87+
then:
88+
snapshotter.assertThat(result.source).matchesSnapshot()
89+
90+
where:
91+
conditionMethod << [
92+
'with',
93+
'verifyAll',
94+
'verifyEach'
95+
]
96+
}
97+
98+
def "condition method #conditionMethod within condition method #conditionMethod with only exception"() {
99+
when:
100+
def result = compiler.transpileFeatureBody("""
101+
expect:
102+
$conditionMethod(['']) {
103+
$conditionMethod(['']) {
104+
throw new Exception('foo')
105+
}
106+
}
107+
""")
108+
109+
then:
110+
snapshotter.assertThat(result.source).matchesSnapshot()
111+
112+
where:
113+
conditionMethod << [
114+
'with',
115+
'verifyAll',
116+
'verifyEach'
117+
]
118+
}
119+
120+
def "condition method #conditionMethod"() {
121+
when:
122+
def result = compiler.transpileFeatureBody("""
123+
expect:
124+
$conditionMethod(['']) {
125+
false
126+
}
127+
""")
128+
129+
then:
130+
snapshotter.assertThat(result.source).matchesSnapshot()
131+
132+
where:
133+
conditionMethod << [
134+
'with',
135+
'verifyAll',
136+
'verifyEach'
137+
]
138+
}
139+
140+
def "condition method #conditionMethod with exception"() {
141+
when:
142+
def result = compiler.transpileFeatureBody("""
143+
expect:
144+
$conditionMethod(['']) {
145+
true
146+
throw new Exception('foo')
147+
}
148+
""")
149+
150+
then:
151+
snapshotter.assertThat(result.source).matchesSnapshot()
152+
153+
where:
154+
conditionMethod << [
155+
'with',
156+
'verifyAll',
157+
'verifyEach'
158+
]
159+
}
160+
161+
def "condition method #conditionMethod with only exception"() {
162+
when:
163+
def result = compiler.transpileFeatureBody("""
164+
expect:
165+
$conditionMethod(['']) {
166+
throw new Exception('foo')
167+
}
168+
""")
169+
170+
then:
171+
snapshotter.assertThat(result.source).matchesSnapshot()
172+
173+
where:
174+
conditionMethod << [
175+
'with',
176+
'verifyAll',
177+
'verifyEach'
178+
]
179+
}
180+
}

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_explicit_condition.groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/GDK_method_that_looks_like_built_in_method_as_implicit_condition.groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/condition_method__conditionMethod-[0].groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[0].groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/condition_method__conditionMethod-[1].groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[1].groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/condition_method__conditionMethod-[2].groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod-[2].groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/condition_method__conditionMethod_with_exception-[0].groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[0].groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/condition_method__conditionMethod_with_exception-[1].groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[1].groovy

File renamed without changes.

spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/AstSpec/condition_method__conditionMethod_with_exception-[2].groovy renamed to spock-specs/src/test/resources/snapshots/org/spockframework/smoke/ast/condition/ConditionMethodsAstSpec/condition_method__conditionMethod_with_exception-[2].groovy

File renamed without changes.

0 commit comments

Comments
 (0)