-
Notifications
You must be signed in to change notification settings - Fork 232
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
__FL__ added and tested #3574
Closed
Closed
__FL__ added and tested #3574
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9b114bd
Two changes: 1) __FL__ lexeme in FStarC_Parser_LexFStar.ml 2) tests/v…
briangmilnes 6bcf77a
Moved to assert_norm instead of opening tactics and using assert(..) …
briangmilnes 60f36d1
Moved Test.LexemeFL to micro-benchmarks got rid of tests/validation-time
briangmilnes 5b221d0
Merge branch 'master' into milnes-fl
briangmilnes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// A new lexeme __FL__ has been added to show file and line (file(line)) to make writing tests easier. | ||
/// This file is line sensitive any edit will change the value of __FL__. | ||
module Test.LexemeFL | ||
|
||
open FStar.String | ||
module LT = FStar.List.Tot | ||
// Kinda funky to get a good validation time test, added Strings in other PR will fix this. | ||
// The lexer is sending back some strange character that we have to adjust. | ||
let fl = __FL__ | ||
let _ = assert(fl <> "") | ||
let fl' = string_of_list (list_of_string "Test.LexemFL.fst(11)") | ||
let _ = assert_norm((strlen fl') = 20) | ||
let _ = assert_norm(fl' = "Test.LexemFL.fst(11)") |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
__FL__
seems a bit obscure to me, should we maybe call this__FILELINE__
? But I don't have a strong opinion, would be good if others chime in.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.
You have to reference it in every test so long is kind of cumbersome. For example:
let test_system n =
let r = FStar.Unix.system "echo HI" in
match r with
| WEXITED e -> if_test FL (e = 0) n None
| _ -> final_fail FL n None
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.
I agree with Guido, I aslo find FL a bit obscure.
IMO, aggregating LINE and SOURCE_FILE in this formatting is quite opinionated and should probably be user-defined.
@briangmilnes why not using a tactic for that here, e.g.:
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 for logging and test packages. Nothing should be left to the user. In testing the ocaml wrap of unix and a few other things, I need the file/line 139 times. Terse is good here, although I eschew it in almost all situations.
A tactic that allows a function is a great alternative. The language server in emacs takes that and works but I can't get a command line to compile it. What's the change needed for compilation? It also has the advantage that the strings are not coming back from the lexer with strange UTF8.
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.
Well, verbosity or terseness is a choice, right? I tend to prefer verbosity in such cases, but that's only my preference.
Nice! Here it won't work via the command line because of
<input>
: that's the file name given by the F* interactive protocol used by emacs I believe.Running that from a file whose path is
/tmp/Hello.fst
, you should be able toassert_norm (file_line == "/tmp/Hello.fst(15)")
(instead of the one I've put above).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.
The issue I have is it will not compile, not the string back from fl() or FL.
F*orge: VALIDATE _build/fstar/fst/checked/Hello.fst.checked
1 error was reported (see above)
That's the (# line on my test of it running in OCaml.