Skip to content

Commit 2724407

Browse files
committed
Merge pull request #325 from brunobowden/fixup
CompileStatic for J2objcConfig and UtilsTest
2 parents 52d2e16 + 6793f97 commit 2724407

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/test/groovy/com/github/j2objccontrib/j2objcgradle/J2objcConfigTest.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.github.j2objccontrib.j2objcgradle
1818

19+
import groovy.transform.CompileStatic
20+
import groovy.transform.TypeCheckingMode
1921
import org.gradle.api.InvalidUserDataException
2022
import org.gradle.api.Project
2123
import org.gradle.testfixtures.ProjectBuilder
@@ -26,6 +28,7 @@ import org.junit.Test
2628
/**
2729
* J2objcConfig tests.
2830
*/
31+
@CompileStatic
2932
class J2objcConfigTest {
3033

3134
private Project proj
@@ -77,6 +80,7 @@ class J2objcConfigTest {
7780
}
7881

7982
@Test
83+
@CompileStatic(TypeCheckingMode.SKIP)
8084
void testTranslateArgs() {
8185
J2objcConfig ext = new J2objcConfig(proj)
8286

src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/TestingUtils.groovy

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class TestingUtils {
8383
J2objcConfig j2objcConfig = null
8484
if (config.applyJ2objcPlugin) {
8585
proj.pluginManager.apply(J2objcPlugin)
86-
j2objcConfig = proj.extensions.getByName('j2objcConfig')
86+
j2objcConfig = (J2objcConfig) proj.extensions.getByName('j2objcConfig')
8787
} else if (config.createJ2objcConfig) {
8888
// can't use the config from the J2objcPlugin:
8989
j2objcConfig = proj.extensions.create('j2objcConfig', J2objcConfig, proj)
@@ -95,7 +95,6 @@ class TestingUtils {
9595
assert reportsDir.mkdirs()
9696
}
9797

98-
9998
return [proj, j2objcHome, j2objcConfig]
10099
}
101100

src/test/groovy/com/github/j2objccontrib/j2objcgradle/tasks/UtilsTest.groovy

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.github.j2objccontrib.j2objcgradle.tasks
1818

19+
import groovy.transform.CompileStatic
1920
import org.apache.commons.io.output.TeeOutputStream
2021
import org.gradle.api.InvalidUserDataException
2122
import org.gradle.api.Project
@@ -33,6 +34,7 @@ import org.junit.rules.ExpectedException
3334
/**
3435
* Utils tests.
3536
*/
37+
@CompileStatic
3638
class UtilsTest {
3739

3840
private Project proj
@@ -182,7 +184,7 @@ class UtilsTest {
182184
'src/test/resources/com/github/j2objccontrib/j2objcgradle/tasks/prefixes.properties')
183185

184186
List<String> translateArgs = new ArrayList<String>()
185-
translateArgs.add("--prefixes ${prefixesProp.absolutePath}")
187+
translateArgs.add('--prefixes ' + prefixesProp.absolutePath)
186188
Properties properties = Utils.packagePrefixes(proj, translateArgs)
187189

188190
Properties expected = new Properties()
@@ -202,7 +204,7 @@ class UtilsTest {
202204
List<String> translateArgs = new ArrayList<String>()
203205
// prefix is overwritten by prefixes.properties
204206
translateArgs.add('--prefix com.example.parent=ParentPrefixArg')
205-
translateArgs.add("--prefixes ${prefixesProp.absolutePath}")
207+
translateArgs.add('--prefixes ' + prefixesProp.absolutePath)
206208
// prefix overwrites prefixes.properties
207209
translateArgs.add('--prefix com.example.parent.subdir=SubdirPrefixArg')
208210

@@ -261,11 +263,13 @@ class UtilsTest {
261263
void testMatchRegexOutputStreams_MatchString() {
262264
ByteArrayOutputStream stdout = new ByteArrayOutputStream()
263265
ByteArrayOutputStream stderr = new ByteArrayOutputStream()
266+
264267
stdout.write('written-stdout'.getBytes('utf-8'))
265268
stderr.write('written-stderr'.getBytes('utf-8'))
266269

267-
assert null != Utils.matchRegexOutputs(stdout, stderr, /(std+out)/).equals('stdout')
268-
assert null != Utils.matchRegexOutputs(stdout, stderr, /(std+err)/).equals('stderr')
270+
// Match each regex against both OutputStreams
271+
assert 'stdout' == Utils.matchRegexOutputs(stdout, stderr, /(std+out)/)
272+
assert 'stderr' == Utils.matchRegexOutputs(stdout, stderr, /(std+err)/)
269273
}
270274

271275
@Test

0 commit comments

Comments
 (0)