Better test case

This commit is contained in:
jilen 2025-07-02 15:46:40 +08:00
parent ed1952b915
commit 071b27abcf

View file

@ -75,7 +75,10 @@ class FromExprsSuite extends FunSuite {
testFor("Action - Returning") {
Returning(
Insert(Ident("table"), List(Assignment(Ident("x"), Ident("col"), Ident("val")))),
Insert(
Ident("table"),
List(Assignment(Ident("x"), Ident("col"), Ident("val")))
),
Ident("x"),
Property(Ident("x"), "id")
)
@ -83,12 +86,35 @@ class FromExprsSuite extends FunSuite {
testFor("Action - ReturningGenerated") {
ReturningGenerated(
Insert(Ident("table"), List(Assignment(Ident("x"), Ident("col"), Ident("val")))),
Insert(
Ident("table"),
List(Assignment(Ident("x"), Ident("col"), Ident("val")))
),
Ident("x"),
Property(Ident("x"), "generatedId")
)
}
testFor("Action - Val outside") {
val p1 = Update(
Ident("table"),
List(Assignment(Ident("x"), Ident("col"), Ident("val")))
)
val p2 = Ident("x")
val p3 = Property(Ident("x"), "id")
Returning(p1, p2, p3)
}
testFor("Action - ReturningGenerated with Update") {
val p1 = Update(
Ident("table"),
List(Assignment(Ident("x"), Ident("col"), Ident("val")))
)
val p2 = Ident("x")
val p3 = Property(Ident("x"), "id")
ReturningGenerated(p1, p2, p3)
}
testFor("If expression") {
If(Ident("cond"), Ident("then"), Ident("else"))
}