-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
feature: adds fixtures to support multiple files from string #272
Conversation
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.
Other than some grammar mistakes, this looks great! 👍
crates/mun_test/src/fixture.rs
Outdated
const DEFAULT_FILE_NAME: &str = "main.mun"; | ||
const META_LINE: &str = "//-"; | ||
|
||
/// A `Fixtures` describes an single file in a project workspace. `Fixture`s can be parsed from a |
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.
/// A `Fixtures` describes an single file in a project workspace. `Fixture`s can be parsed from a | |
/// A `Fixture` describes a multiple files in a project workspace. `Fixture`s can be parsed from a |
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.
No thats actually correct. The struct itself describes a single file in a project workspace. When calling parse a collection is returned.
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 fixtures (plural class name) part or the singular file? It seems like you define multiple Mun files in your fixture, not a single one?
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.
It should be A Fixture describes a single file in a project workspace.
Does that make sense?
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 my understanding of what a fixture is, is wrong then. I thought that the following snippet contained one fixture, comprised of two files.
Fixture::parse(
r#"
//- /foo.mun
fn hello_world() {
}
//- /bar.mun
fn baz() {
}
"#
)
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.
Parsing the given strings returns a Vec<Fixture>
. One entry for foo.mun
and one for bar.mun
.
8458f98
to
ab46466
Compare
Codecov Report
@@ Coverage Diff @@
## master #272 +/- ##
=========================================
Coverage ? 79.10%
=========================================
Files ? 219
Lines ? 13024
Branches ? 0
=========================================
Hits ? 10303
Misses ? 2721
Partials ? 0
Continue to review full report at Codecov.
|
Can we merge this @Wodann ? |
Adds the ability to construct test fixtures that consist of multiple files from a single string. A fixture with multiple files looks like this:
This is used by the MockDatabase to enable creating tests for multiple files.