Skip to content

Commit

Permalink
Add relevant unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dungpa committed Sep 11, 2015
1 parent 91b45f2 commit 45c8e02
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// #Regression #Diagnostics
//<Expects status="warning" span="(4,11-4,19)" id="FS3189">Redundant arguments are being ignored in function 'failwith'\. Expected 1 but got 2 arguments\.$</Expects>
module M
let f() = failwith "Used" "Ignored"
let g() = failwith "Used"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// #Regression #Diagnostics
//<Expects status="warning" span="(4,11-4,20)" id="FS3189">Redundant arguments are being ignored in function 'failwithf'\. Expected 3 but got 4 arguments\.$</Expects>
module M
let f() = failwithf "Used %A %s" "this" "but not" "this"
let g() = failwith "Used %A" "this"
let h() =
let failwithf arg = Printf.ksprintf failwith arg
failwithf "Used" "Ignored"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// #Regression #Diagnostics
//<Expects status="warning" span="(6,5-6,15)" id="FS3189">Redundant arguments are being ignored in function 'invalidArg'\. Expected 2 but got 3 arguments\.$</Expects>
module M
type T() =
member __.M1 source =
invalidArg source "Used" "Ignored"
member __.M2 source =
invalidArg source "Used"
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// #Regression #Diagnostics
//<Expects status="warning" span="(6,20-6,29)" id="FS3189">Redundant arguments are being ignored in function 'invalidOp'\. Expected 1 but got 2 arguments\.$</Expects>
namespace M0
module M1 =
module M2 =
let f source = invalidOp source "Ignored"
let g source = invalidOp source
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// #Regression #Diagnostics
//<Expects status="warning" span="(6,17-6,24)" id="FS3189">Redundant arguments are being ignored in function 'nullArg'\. Expected 1 but got 2 arguments\.$</Expects>
namespace M0
module M1 =
module M2 =
let f arg = nullArg "arg" "Ignored"
let g arg = nullArg "arg"
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// #Regression #Diagnostics
//<Expects status="warning" span="(6,5-6,10)" id="FS3189">Redundant arguments are being ignored in function 'raise'\. Expected 1 but got 2 arguments\.$</Expects>
module M
type T() =
member __.M1() =
raise (exn()) "Ignored"
member __.M2() =
raise (exn())
9 changes: 8 additions & 1 deletion tests/fsharpqa/Source/Diagnostics/General/env.lst
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,11 @@ ReqPP SOURCE=E_UnxpectedMeasureAnnotation01.fs SCFLAGS="-r:FSharp.PowerPack.dll
ReqPP SOURCE=W_WebExtensionsNotInPowerPack01.fs SCFLAGS="--test:ErrorRanges -r:FSharp.PowerPack.dll" COMPILE_ONLY=1 # W_WebExtensionsNotInPowerPack01.fs
SOURCE=E_InvalidObjectExpression01.fs SCFLAGS="--test:ErrorRanges" #E_InvalidObjectExpression01.fs

SOURCE=W_CreateIDisposable.fs SCFLAGS="--test:ErrorRanges -a" # W_CreateIDisposable.fs
SOURCE=W_CreateIDisposable.fs SCFLAGS="--test:ErrorRanges -a" # W_CreateIDisposable.fs

SOURCE=W_FailwithRedundantArgs.fs SCFLAGS="--test:ErrorRanges -a" # W_FailwithRedundantArgs.fs
SOURCE=W_FailwithfRedundantArgs.fs SCFLAGS="--test:ErrorRanges -a" # W_FailwithfRedundantArgs.fs
SOURCE=W_RaiseRedundantArgs.fs SCFLAGS="--test:ErrorRanges -a" # W_RaiseRedundantArgs.fs
SOURCE=W_InvalidArgRedundantArgs.fs SCFLAGS="--test:ErrorRanges -a" # W_InvalidArgRedundantArgs.fs
SOURCE=W_NullArgRedundantArgs.fs SCFLAGS="--test:ErrorRanges -a" # W_NullArgRedundantArgs.fs
SOURCE=W_InvalidOpRedundantArgs.fs SCFLAGS="--test:ErrorRanges -a" # W_InvalidOpRedundantArgs.fs
1 change: 1 addition & 0 deletions tests/fsharpqa/Source/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,4 @@ Misc02 Stress
Misc02 XmlDoc\Basic
Misc02 XmlDoc\OCamlDoc
Misc02 XmlDoc\UnitOfMeasure
Diagnostics Diagnostics\General

0 comments on commit 45c8e02

Please sign in to comment.