From dbbd07572419e5d07f52fcb82ebfbae30173eece Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 7 Jul 2021 20:25:27 +0000 Subject: [PATCH 1/3] Make flaky numeric test JVM-only --- ast/shared/src/test/scala/jawn/AstTest.scala | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ast/shared/src/test/scala/jawn/AstTest.scala b/ast/shared/src/test/scala/jawn/AstTest.scala index f79cdd9e..b0088922 100644 --- a/ast/shared/src/test/scala/jawn/AstTest.scala +++ b/ast/shared/src/test/scala/jawn/AstTest.scala @@ -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( @@ -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) && From 36f552c94a6e4b8b1e36b544c4e64544cd335637 Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 7 Jul 2021 20:29:15 +0000 Subject: [PATCH 2/3] Add forgotten platform-files --- .../test/scala/jawn/ast/AstTestPlatform.scala | 4 ++++ .../test/scala/jawn/ast/AstTestPlatform.scala | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 ast/js/src/test/scala/jawn/ast/AstTestPlatform.scala create mode 100644 ast/jvm/src/test/scala/jawn/ast/AstTestPlatform.scala diff --git a/ast/js/src/test/scala/jawn/ast/AstTestPlatform.scala b/ast/js/src/test/scala/jawn/ast/AstTestPlatform.scala new file mode 100644 index 00000000..2c9b4e01 --- /dev/null +++ b/ast/js/src/test/scala/jawn/ast/AstTestPlatform.scala @@ -0,0 +1,4 @@ +package org.typelevel.jawn +package ast + +private[jawn] trait AstTestPlatform diff --git a/ast/jvm/src/test/scala/jawn/ast/AstTestPlatform.scala b/ast/jvm/src/test/scala/jawn/ast/AstTestPlatform.scala new file mode 100644 index 00000000..a0aad57a --- /dev/null +++ b/ast/jvm/src/test/scala/jawn/ast/AstTestPlatform.scala @@ -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) + ) + } + +} From 3ffd2990046cc186a3c473238b0460736feeb84f Mon Sep 17 00:00:00 2001 From: Arman Bilge Date: Wed, 7 Jul 2021 20:32:12 +0000 Subject: [PATCH 3/3] Fix name consistency --- .../jawn/ast/{ParseCheckPlatform.scala => AstCheckPlatform.scala} | 0 .../jawn/ast/{ParseCheckPlatform.scala => AstCheckPlatform.scala} | 0 .../src/test/scala/jawn/{ParseCheck.scala => AstCheck.scala} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename ast/js/src/test/scala/jawn/ast/{ParseCheckPlatform.scala => AstCheckPlatform.scala} (100%) rename ast/jvm/src/test/scala/jawn/ast/{ParseCheckPlatform.scala => AstCheckPlatform.scala} (100%) rename ast/shared/src/test/scala/jawn/{ParseCheck.scala => AstCheck.scala} (100%) diff --git a/ast/js/src/test/scala/jawn/ast/ParseCheckPlatform.scala b/ast/js/src/test/scala/jawn/ast/AstCheckPlatform.scala similarity index 100% rename from ast/js/src/test/scala/jawn/ast/ParseCheckPlatform.scala rename to ast/js/src/test/scala/jawn/ast/AstCheckPlatform.scala diff --git a/ast/jvm/src/test/scala/jawn/ast/ParseCheckPlatform.scala b/ast/jvm/src/test/scala/jawn/ast/AstCheckPlatform.scala similarity index 100% rename from ast/jvm/src/test/scala/jawn/ast/ParseCheckPlatform.scala rename to ast/jvm/src/test/scala/jawn/ast/AstCheckPlatform.scala diff --git a/ast/shared/src/test/scala/jawn/ParseCheck.scala b/ast/shared/src/test/scala/jawn/AstCheck.scala similarity index 100% rename from ast/shared/src/test/scala/jawn/ParseCheck.scala rename to ast/shared/src/test/scala/jawn/AstCheck.scala