-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate.IParamCollection.forAll
#88
base: main
Are you sure you want to change the base?
Changes from all commits
bbc013d
1250e91
bd4d2de
722f808
ef46838
51030b3
b008d98
bc3d4aa
528155d
573dd08
9d46428
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,45 @@ type ErrorMessage = | |
str.AppendFormat(" > line '{0}'", line) |> ignore | ||
| None -> () | ||
|
||
match Param.tryGetValueOfCvParamAttr "Position" iParam with | ||
| Some position -> | ||
str.AppendFormat(" > position '{0}'", position) |> ignore | ||
| None -> () | ||
str.ToString() | ||
|
||
|
||
static member ofIParamCollection error iParamCollection = | ||
|
||
let iParam = Seq.head iParamCollection | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not get these functions to be honest. The API naming indicates that it generates error messages from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, since printing all items would be too much. I mean, this is arbitrary. How many items do we want to display? I chose 1, but we could also do 3 or 5 or any number... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Not really, ideally you want to know all items that do not satisfy the predicate |
||
|
||
let str = new StringBuilder() | ||
str.AppendFormat("['{0}', ..] {1}\n", Param.getCvName iParam, error) |> ignore | ||
|
||
match Param.tryGetValueOfCvParamAttr "FilePath" iParam with | ||
| Some path -> | ||
str.AppendFormat(" > filePath '{0}'\n", path) |> ignore | ||
| None -> () | ||
|
||
match Param.tryGetValueOfCvParamAttr "Worksheet" iParam with | ||
| Some sheet -> | ||
str.AppendFormat(" > sheet '{0}'", sheet) |> ignore | ||
| None -> () | ||
|
||
match Param.tryGetValueOfCvParamAttr "Row" iParam with | ||
| Some row -> | ||
str.AppendFormat(" > row '{0}'", row) |> ignore | ||
| None -> () | ||
|
||
match Param.tryGetValueOfCvParamAttr "Column" iParam with | ||
| Some column -> | ||
str.AppendFormat(" > column '{0}'", column) |> ignore | ||
| None -> () | ||
|
||
match Param.tryGetValueOfCvParamAttr "Line" iParam with | ||
| Some line -> | ||
str.AppendFormat(" > line '{0}'", line) |> ignore | ||
| None -> () | ||
|
||
match Param.tryGetValueOfCvParamAttr "Position" iParam with | ||
| Some position -> | ||
str.AppendFormat(" > position '{0}'", position) |> ignore | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module ErrorMessageTests | ||
|
||
|
||
open Expecto | ||
open ARCExpect | ||
open ControlledVocabulary | ||
|
||
|
||
let dummyIParam = CvParam("test:0", "testTerm", "test", ParamValue.Value "no val") | ||
let dummyIParamColl = List.init 3 (fun _ -> dummyIParam) | ||
|
||
|
||
[<Tests>] | ||
let ``ErrorMessage tests`` = | ||
testList "ErrorMessage" [ | ||
testList "ofIParamCollection" [ | ||
testCase "resolves correctly" <| fun _ -> | ||
let eMsg = ErrorMessage.ofIParamCollection "does not satisfy" dummyIParamColl | ||
Expect.equal eMsg "['testTerm', ..] does not satisfy\n" "resolved incorrectly" | ||
] | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not used anymore in the current state of the PR is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kMutagene