Skip to content

Commit 8966326

Browse files
authored
Use snapshotId instead of separate tests (#2207)
1 parent 15eb783 commit 8966326

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
lines changed

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

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -344,30 +344,10 @@ class Ext <T extends Serializable, V extends Cloneable> {
344344
snapshotter.assertThat(result.source).matchesSnapshot()
345345
}
346346
347-
@Requires({ GroovyRuntimeUtil.groovy4orNewer })
348-
def "Primitive types are used in AST transformation Groovy >= 4"() {
349-
when:
350-
def result = compiler.transpileWithImports('''
351-
class TestSpec extends Specification {
352-
def 'test'() {
353-
expect:
354-
true
355-
when:
356-
true
357-
then:
358-
thrown(RuntimeException)
359-
}
360-
}
361-
''',
362-
EnumSet.of(Show.METHODS),
363-
CompilePhase.OUTPUT)
364-
365-
then:
366-
textSnapshotter.assertThat(result.source).matchesSnapshot()
367-
}
347+
def "Primitive types are used in AST transformation"() {
348+
given:
349+
def snapshotId = GroovyRuntimeUtil.groovy4orNewer ? "groovy4" : ""
368350
369-
@Requires({ GroovyRuntimeUtil.groovy3orOlder })
370-
def "Primitive types are used in AST transformation Groovy <= 3"() {
371351
when:
372352
def result = compiler.transpileWithImports('''
373353
class TestSpec extends Specification {
@@ -385,6 +365,6 @@ class TestSpec extends Specification {
385365
CompilePhase.OUTPUT)
386366
387367
then:
388-
textSnapshotter.assertThat(result.source).matchesSnapshot()
368+
textSnapshotter.assertThat(result.source).matchesSnapshot(snapshotId)
389369
}
390370
}

0 commit comments

Comments
 (0)