gdsl: assertVersion as agreed

This commit is contained in:
peter
2011-10-21 13:41:34 +02:00
parent 5ee6e2c79b
commit cf1436f0b7
2 changed files with 26 additions and 6 deletions
@@ -105,8 +105,12 @@ public class GroovyDslExecutor {
return StringUtil.compareVersionNumbers(ideaVersion, ver) >= 0
}
else if (ver instanceof Map) {
def we = ver.ide?.intellij
return we != null && StringUtil.compareVersionNumbers(ideaVersion, we) >= 0
if (ver.dsl) {
return StringUtil.compareVersionNumbers('1.0', ver.dsl) >= 0
}
if (ver.intellij) {
return StringUtil.compareVersionNumbers(ideaVersion, ver.intellij) >= 0
}
}
return false
}
@@ -127,13 +127,13 @@ def doo() { println <warning>foo</warning> }
public void testSupportsVersion() {
checkHighlighting '''
if (supportsVersion(ide:[intellij:'9.0'])) {
if (supportsVersion(intellij:'9.0')) {
contribute(currentType("java.lang.String")) { property name:"foo" }
} else {
contribute(currentType("java.lang.String")) { property name:"bar" }
}
if (!supportsVersion(ide:[groovyEclipse:'9.0'])) {
if (!supportsVersion(groovyEclipse:'9.0')) {
contribute(currentType("java.lang.String")) { property name:"goo" }
}
''',
@@ -142,7 +142,15 @@ if (!supportsVersion(ide:[groovyEclipse:'9.0'])) {
public void testAssertVersion() {
checkHighlighting '''
assertVersion ide:[intellij:'9.0']
assertVersion dsl:'1.0'
contribute(currentType("java.lang.String")) { property name:"foo" }
''',
'println "".foo'
}
public void testAssertVersionDsl() {
checkHighlighting '''
assertVersion intellij:'9.0'
contribute(currentType("java.lang.String")) { property name:"foo" }
''',
'println "".foo'
@@ -150,7 +158,15 @@ contribute(currentType("java.lang.String")) { property name:"foo" }
public void testAssertVersionFail() {
checkHighlighting '''
assertVersion ide:[intellij:'239.0']
assertVersion intellij:'239.0'
contribute(currentType("java.lang.String")) { property name:"foo" }
''',
'println "".<warning>foo</warning>'
}
public void testAssertVersionFailDsl() {
checkHighlighting '''
assertVersion dsl:'239.0'
contribute(currentType("java.lang.String")) { property name:"foo" }
''',
'println "".<warning>foo</warning>'