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 = implicit override val generatorDrivenConfig =
// Tests here are lightweight, so we can afford to run more of them // Tests here are lightweight, so we can afford to run more of them
PropertyCheckConfiguration(minSuccessful = 500) PropertyCheckConfiguration(minSuccessful = 500, sizeRange = 64)
val shortAlphaNumStr = for { val shortAlphaNumStr = for {
length <- Gen.choose(1, 10) length <- Gen.choose(1, 10)
chars <- Gen.listOfN(5, Gen.alphaNumChar) chars <- Gen.listOfN(length, Gen.alphaNumChar)
} yield chars.mkString } yield chars.mkString
val fileNameWithExt = Gen val fileNameWithExt = Gen
@ -29,7 +29,7 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
Gen.sized(size => Gen.sized(size =>
for { for {
segments <- Gen.listOfN( segments <- Gen.listOfN(
size / 5, size,
Gen.oneOf( Gen.oneOf(
shortAlphaNumStr, shortAlphaNumStr,
Gen.oneOf(".", "..") Gen.oneOf(".", "..")
@ -49,7 +49,7 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
val simplePath: Gen[Path] = Gen.sized(size => val simplePath: Gen[Path] = Gen.sized(size =>
for { for {
segments <- Gen.listOfN( segments <- Gen.listOfN(
size / 5, size,
shortAlphaNumStr shortAlphaNumStr
) )
suffix <- Gen.option( suffix <- Gen.option(
@ -88,8 +88,12 @@ class ImportsSpec extends AnyFlatSpec with ScalaCheckPropertyChecks with Matcher
}.map(Imports.apply) }.map(Imports.apply)
) )
val nonEmptyAsciiPrintableStr: Gen[String] = val nonEmptyAsciiPrintableStr: Gen[String] = Gen.sized(size =>
Gen.nonEmptyListOf(Gen.asciiPrintableChar).map(_.mkString) for {
head <- Gen.asciiPrintableChar
tail <- Gen.listOfN(size, Gen.asciiPrintableChar)
} yield (head +: tail).mkString
)
"Imports" should "resolve relative import first" in { "Imports" should "resolve relative import first" in {
forAll( 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.checkTokenLoc(main, "fooResult", 0, ScalarType.string) shouldBe true
res.checkLocations("fooResult", 0, 1, main) 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.checkLocations("someVar", 0, 1, main) shouldBe true
res.checkTokenLoc(main, "someVar", 2, LiteralType.unsigned) shouldBe true res.checkTokenLoc(main, "someVar", 2, LiteralType.unsigned) shouldBe true
res.checkLocations("someVar", 2, 3, main) shouldBe true res.checkLocations("someVar", 2, 3, main) shouldBe true
@ -221,8 +221,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
"someField", "someField",
0, 0,
ScalarType.u32, ScalarType.u32,
Some("Ab.someField"), Some("Ab.someField")
true
) shouldBe true ) shouldBe true
// this is tokens from imports, if we will use `FileSpan.F` file names will be different // 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", "more_call",
0, 0,
ArrowType(NilType, NilType), ArrowType(NilType, NilType),
Some("OneMore.more_call"), Some("OneMore.more_call")
true
) shouldBe true ) shouldBe true
res.checkTokenLoc( res.checkTokenLoc(
secondImport, secondImport,
@ -253,8 +251,7 @@ class AquaLSPSpec extends AnyFlatSpec with Matchers with Inside {
ProductType.labelled(("someVar", ScalarType.string) :: Nil), ProductType.labelled(("someVar", ScalarType.string) :: Nil),
ProductType(ScalarType.string :: Nil) ProductType(ScalarType.string :: Nil)
), ),
None, None
true
) shouldBe true ) shouldBe true
res.checkTokenLoc(firstImport, "someVar", 0, ScalarType.string) shouldBe true res.checkTokenLoc(firstImport, "someVar", 0, ScalarType.string) shouldBe true