Skip to content

Commit

Permalink
Merge pull request #354 from armanbilge/fix-353
Browse files Browse the repository at this point in the history
Make flaky numeric test JVM-only
  • Loading branch information
rossabaker authored Jul 7, 2021
2 parents 1cf6adc + 3ffd299 commit 503494a
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
4 changes: 4 additions & 0 deletions ast/js/src/test/scala/jawn/ast/AstTestPlatform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.typelevel.jawn
package ast

private[jawn] trait AstTestPlatform
19 changes: 19 additions & 0 deletions ast/jvm/src/test/scala/jawn/ast/AstTestPlatform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.typelevel.jawn
package ast

import org.scalacheck.Prop

import Prop.forAll

private[jawn] trait AstTestPlatform { self: AstTest =>

// See https://github.com/typelevel/jawn/issues/353

property(".getDouble") = forAll { (n: Double) =>
Prop(
JNum(n).getDouble == Some(n) &&
JParser.parseUnsafe(n.toString).getDouble == Some(n)
)
}

}
9 changes: 1 addition & 8 deletions ast/shared/src/test/scala/jawn/AstTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scala.util.{Success, Try}
import ArbitraryUtil._
import Prop.forAll

class AstTest extends Properties("AstTest") {
class AstTest extends Properties("AstTest") with AstTestPlatform {

property("calling .get never crashes") = forAll { (v: JValue, s: String, i: Int) =>
Prop(
Expand Down Expand Up @@ -48,13 +48,6 @@ class AstTest extends Properties("AstTest") {
)
}

property(".getDouble") = forAll { (n: Double) =>
Prop(
JNum(n).getDouble == Some(n) &&
JParser.parseUnsafe(n.toString).getDouble == Some(n)
)
}

property(".getBigInt") = forAll { (n: BigInt) =>
Prop(
JNum(n.toString).getBigInt == Some(n) &&
Expand Down

0 comments on commit 503494a

Please sign in to comment.