mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
fix tests
This commit is contained in:
parent
cb1a5d3aa0
commit
b01be3d161
@ -10,7 +10,6 @@ import org.scalatest.flatspec.AnyFlatSpec
|
||||
import org.scalatest.matchers.should.Matchers
|
||||
import aqua.parser.lift.LiftParser.Implicits.idLiftParser
|
||||
import cats.Id
|
||||
import shapeless.HNil
|
||||
|
||||
import scala.language.implicitConversions
|
||||
|
||||
|
@ -32,22 +32,22 @@ class FuncSpec extends AnyFlatSpec with Matchers with EitherValues {
|
||||
def funcExpr(str: String): FuncExpr[Id] = FuncExpr.p[Id].parseAll(str).value
|
||||
|
||||
"func header" should "parse" in {
|
||||
funcExpr("func some() -> bool:\n") should be(FuncExpr(toName("some"), List(), Some(bool: BasicTypeToken[Id])))
|
||||
funcExpr("func some():\n") should be(FuncExpr(toName("some"), List(), None))
|
||||
funcExpr("func some() -> bool:\n") should be(FuncExpr(toName("some"), List(), Some(bool: BasicTypeToken[Id]), None))
|
||||
funcExpr("func some():\n") should be(FuncExpr(toName("some"), List(), None, None))
|
||||
|
||||
val arrowToken = ArrowTypeToken[Id]((), List(BasicTypeToken[Id](u32)), Some(BasicTypeToken[Id](bool)))
|
||||
funcExpr("func some(peer: PeerId, other: u32 -> bool):\n") should be(
|
||||
FuncExpr(toName("some"), List(toCustomArg("peer", "PeerId"), toArg("other", arrowToken)), None)
|
||||
FuncExpr(toName("some"), List(toCustomArg("peer", "PeerId"), toArg("other", arrowToken)), None, None)
|
||||
)
|
||||
|
||||
val arrowToken2 = ArrowTypeToken[Id]((), List(BasicTypeToken[Id](u32), BasicTypeToken[Id](u64)), Some(BasicTypeToken[Id](bool)))
|
||||
funcExpr("func some(peer: PeerId, other: u32, u64 -> bool):\n") should be(
|
||||
FuncExpr(toName("some"), List(toCustomArg("peer", "PeerId"), toArg("other", arrowToken2)), None)
|
||||
FuncExpr(toName("some"), List(toCustomArg("peer", "PeerId"), toArg("other", arrowToken2)), None, None)
|
||||
)
|
||||
|
||||
val arrowToken3 = ArrowTypeToken[Id]((), List(BasicTypeToken[Id](u32)), None)
|
||||
funcExpr("func getTime(peer: PeerId, ret: u32 -> ()) -> string:\n") should be(
|
||||
FuncExpr(toName("getTime"), List(toCustomArg("peer", "PeerId"), toArg("ret", arrowToken3)), Some(BasicTypeToken[Id](string)))
|
||||
FuncExpr(toName("getTime"), List(toCustomArg("peer", "PeerId"), toArg("ret", arrowToken3)), Some(BasicTypeToken[Id](string)), None)
|
||||
)
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user