File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
main/groovy/org/scoverage
test/groovy/org/scoverage Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import org.gradle.api.GradleException
55import org.gradle.api.tasks.TaskAction
66
77import java.text.DecimalFormat
8+ import java.text.NumberFormat
89
910/**
1011 * Handles different types of coverage Scoverage can measure.
@@ -71,8 +72,10 @@ class OverallCheckTask extends DefaultTask {
7172 File reportFile = new File (reportDir ? reportDir : extension. reportDir, coverageType. fileName)
7273
7374 try {
74- def xml = parser. parse(reportFile)
75- Double overallRate = coverageType. normalize(xml. attribute(coverageType. paramName). toDouble())
75+ Node xml = parser. parse(reportFile)
76+ NumberFormat nf = NumberFormat . getInstance(Locale . getDefault());
77+ Double coverageValue = nf. parse(xml. attribute(coverageType. paramName) as String ). doubleValue();
78+ Double overallRate = coverageType. normalize(coverageValue)
7679 def difference = (minimumRate - overallRate)
7780
7881 if (difference > 1e-7 ) {
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import org.gradle.tooling.GradleConnector
55import org.hamcrest.core.Is
66import org.junit.Assert
77
8+ import java.text.NumberFormat
9+
810/**
911 * Some utils for easy acceptance testing.
1012 */
@@ -38,6 +40,8 @@ class AcceptanceTestUtils {
3840 protected Double coverage (File reportDir , CoverageType coverageType ) {
3941 File reportFile = new File (reportDir, coverageType. fileName)
4042 def xml = parser. parse(reportFile)
41- xml. attribute(coverageType. paramName). toDouble()
43+ println (" reportfile path: ${ reportFile.absolutePath} " )
44+ NumberFormat nf = NumberFormat . getInstance(Locale . getDefault());
45+ nf. parse(xml. attribute(coverageType. paramName) as String ). doubleValue();
4246 }
4347}
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ import org.gradle.api.Project
55import org.gradle.testfixtures.ProjectBuilder
66import org.hamcrest.Description
77import org.hamcrest.TypeSafeMatcher
8+ import org.junit.After
9+ import org.junit.AfterClass
10+ import org.junit.Before
11+ import org.junit.BeforeClass
812import org.junit.Rule
913import org.junit.Test
1014import org.junit.rules.ExpectedException
@@ -37,6 +41,17 @@ class CauseMatcher extends TypeSafeMatcher<Throwable> {
3741}
3842
3943class OverallCheckTaskTest {
44+ private static Locale defaultLocale
45+ @BeforeClass
46+ public static void setup () {
47+ defaultLocale = Locale . getDefault()
48+ Locale . setDefault(Locale . US )
49+ }
50+
51+ @AfterClass
52+ public static void tearDown () {
53+ Locale . setDefault(defaultLocale)
54+ }
4055
4156 @Rule
4257 public ExpectedException expectedException = ExpectedException . none()
You can’t perform that action at this time.
0 commit comments