-
Notifications
You must be signed in to change notification settings - Fork 30
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
Improve Files module #220
Improve Files module #220
Conversation
79ae22a
to
da8107d
Compare
- fix imports in FileTests, no abbreviations - added test for the case of file not being found Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
- avoid issues with invoking `som` from other directories Signed-off-by: Stefan Marr <[email protected]>
- using the path of the module allows us to run the tests from arbitrary directories Signed-off-by: Stefan Marr <[email protected]>
Setting an invalid access mode is considered an error an should fail as early as possible. - add documentation of supported access modes. Use simple symbols with camelCase spelling, as practice for everything else. - invalid access mode will raise an ArgumentError on setting it - make effort to have a nice error in that case Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
200440e
to
95f5359
Compare
@daumayr, I did more work on this. Would be good if you could review, especially to know whether you foresee any issues with what you need. |
@Richard-Roberts where's the review then? |
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.
Looks good to me, so much cleaner code when using files when you don't need all those fail blocks.
core-lib/Files.ns
Outdated
public open: mode <Symbol> ifFail: err <[:IOException | X def]> ^ <FileDescriptor | X> = ( | ||
(* Open file with given access mode. | ||
Access mode can be #read, #write, or #readWrite. *) | ||
public open: mode <Symbol> ifFail: errBlock <[:Symbol | X def]> ^ <FileDescriptor | X> = ( | ||
(* Modes: #read, #write, #readWrite *) |
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 guess thats no longer needed?
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 comment line
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.
Why? Think it is good practice to provide comments to all methods.
Ideally, VS code is going to show them at some point. (Think we only need to track them during parsing, if we don't do it yet, and then show them on the corresponding request. should be pretty simple)
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 mean the old one, the content is in the new one, so redundant
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.
aaah, now I see it, yes :) thanks
Signed-off-by: Stefan Marr <[email protected]>
…referably to indicate failure causes in blocks Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
586de9b
to
00bb6b6
Compare
Signed-off-by: Stefan Marr <[email protected]>
Signed-off-by: Stefan Marr <[email protected]>
Going to merge this once CI on GitLab/Brussels finished successfully |
The goal of this PR is to improve test coverage, correctness, style, API, and functionality of the Files.ns module.
Main Changes
#read
,#write
,#readWrite
, add documentationSFileDescriptor
Incidental Changes
ClassDefinitionMirror>>#filePath
to be able to access the file path of a modulesom
and JaCoCo support robust to different current working directory