-
Notifications
You must be signed in to change notification settings - Fork 48
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
Create RFC Simple Tests #57
base: master
Are you sure you want to change the base?
Conversation
I recommend that you link directly to rich format like Rust contributors do: https://github.com/webdesus/fs_extra/blob/RFC-Simle-Test/rfc/simplify_tests.md |
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.
Nice RFC. I agree, this is the right solution for testing. My first idea was about using macros, but YAML works even better. I do not see any downsides for this approach. YAML is a heavy dependency, but acceptable here as a dev dependency.
I'm thinking about YAML data format. The RFC should explain a little the test format with more than examples.
I propose another data format. I did not like type: FILE
/ DIRECTORY
. Example:
NAME: it_copies_work
FILES:
test.txt: test_data
out:
test.txt: test_data
empty_file: ""
empty_directory: {}
Formal description:
The declarative approach uses the YAML format to declare filesystem trees.
The TestFS
struct has two methods, new
and check
, that accept one argument, a string in the YAML format that parses to a hash. Argument to method new
must parse to a hash with two entries, a string under the NAME
key, and a filesystem tree description under the FILES
key. Argument to method check
must parse to a filesystem tree description.
A filesystem tree description is a hash. Each value in this hash is either a string or a hash. If a string, the corresponding key is a file name and the value is the file's content. If a hash, the key is a directory name and the value is the directory's tree in the same format as filesystem tree description.
A filesystem tree description may be empty. Example:
NAME: it_does_something
FILES: {}
In personal conversation @pczarn proposed additional changes for format: file.txt: {
content:"data",
modified: "2022-05-10 14:45"
},
simple_file.txt: "data" This format allows using meta information for file and directory. My propose using slash example: file.txt: "data",
/dir,
/another_dir: {
modified: "2022-05-10 14:45"
}
another_file: "data" |
Submit for discussion