fix(tests): Lower tests size (#1018)

* Lower tests size

* Remove prints
This commit is contained in:
InversionSpaces 2023-12-14 10:27:14 +01:00 committed by GitHub
parent bb013d79f7
commit 6732f8f2cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View File

@ -11,11 +11,11 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
implicit override val generatorDrivenConfig =
// Tests here are lightweight, so we can afford to run more of them
PropertyCheckConfiguration(minSuccessful = 500)
PropertyCheckConfiguration(minSuccessful = 500, sizeRange = 64)
val shortAlphaNumStr = for {
length <- Gen.choose(1, 10)
chars <- Gen.listOfN(5, Gen.alphaNumChar)
chars <- Gen.listOfN(length, Gen.alphaNumChar)
} yield chars.mkString
val fileNameWithExt = Gen
@ -29,7 +29,7 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
Gen.sized(size =>
for {
segments <- Gen.listOfN(
size / 5,
size,
Gen.oneOf(
shortAlphaNumStr,
Gen.oneOf(".", "..")
@ -49,7 +49,7 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
val simplePath: Gen[Path] = Gen.sized(size =>
for {
segments <- Gen.listOfN(
size / 5,
size,
shortAlphaNumStr
)
suffix <- Gen.option(
@ -88,8 +88,12 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
}.map(Imports.apply)
)
val nonEmptyAsciiPrintableStr: Gen[String] =
Gen.nonEmptyListOf(Gen.asciiPrintableChar).map(_.mkString)
val nonEmptyAsciiPrintableStr: Gen[String] = Gen.sized(size =>
for {
head <- Gen.asciiPrintableChar
tail <- Gen.listOfN(size, Gen.asciiPrintableChar)
} yield (head +: tail).mkString
)
"Imports" should "resolve relative import first" in {
forAll(

View File

@ -200,7 +200,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
res.checkTokenLoc(main, "fooResult", 0, ScalarType.string) shouldBe true
res.checkLocations("fooResult", 0, 1, main) shouldBe true
res.checkTokenLoc(main, "someVar", 0, LiteralType.string, None, true) shouldBe true
res.checkTokenLoc(main, "someVar", 0, LiteralType.string, None) shouldBe true
res.checkLocations("someVar", 0, 1, main) shouldBe true
res.checkTokenLoc(main, "someVar", 2, LiteralType.unsigned) shouldBe true
res.checkLocations("someVar", 2, 3, main) shouldBe true
@ -221,8 +221,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
"someField",
0,
ScalarType.u32,
Some("Ab.someField"),
true
Some("Ab.someField")
) shouldBe true
// this is tokens from imports, if we will use `FileSpan.F` file names will be different
@ -233,8 +232,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
"more_call",
0,
ArrowType(NilType, NilType),
Some("OneMore.more_call"),
true
Some("OneMore.more_call")
) shouldBe true
res.checkTokenLoc(
secondImport,
@ -253,8 +251,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
ProductType.labelled(("someVar", ScalarType.string) :: Nil),
ProductType(ScalarType.string :: Nil)
),
None,
true
None
) shouldBe true
res.checkTokenLoc(firstImport, "someVar", 0, ScalarType.string) shouldBe true