forked from Zaid-Ajaj/Npgsql.FSharp.Analyzer
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Zaid-Ajaj#32 from dbrattli/set-declare
Add support for timestamp, date, set and declare cursor
- Loading branch information
Showing
6 changed files
with
359 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module ParseDeclareTests | ||
|
||
open Expecto | ||
open NpgsqlFSharpParser | ||
|
||
let testDeclare inputQuery expected = | ||
test inputQuery { | ||
match Parser.parse inputQuery with | ||
| Ok (Expr.DeclareQuery query) -> | ||
Expect.equal query expected "The query is parsed correctly" | ||
| Ok somethingElse -> | ||
failwithf "Unexpected declare statement %A" somethingElse | ||
| Error errorMsg -> | ||
failwith errorMsg | ||
} | ||
|
||
let ftestDeclare inputQuery expected = | ||
ftest inputQuery { | ||
match Parser.parse inputQuery with | ||
| Ok (Expr.DeclareQuery query) -> | ||
Expect.equal query expected "The query is parsed correctly" | ||
| Ok somethingElse -> | ||
failwithf "Unexpected declare statement %A" somethingElse | ||
| Error errorMsg -> | ||
failwith errorMsg | ||
} | ||
|
||
[<Tests>] | ||
let declareQueryTests = testList "Parse DECLARE tests" [ | ||
testDeclare "DECLARE c1 CURSOR FOR SELECT NOW();" ({ | ||
Parameter = "c1" | ||
Query = Expr.SelectQuery { SelectExpr.Default with Columns = [Expr.Function("NOW", [])] } | ||
} |> Cursor) | ||
] | ||
|
Oops, something went wrong.