feature: adds fixtures to support multiple files from string#272
feature: adds fixtures to support multiple files from string#272baszalmstra merged 1 commit intomun-lang:masterfrom
Conversation
Wodann
left a comment
There was a problem hiding this comment.
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.
| /// 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.
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.
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.
It should be A Fixture describes a single file in a project workspace. Does that make sense?
There was a problem hiding this comment.
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.
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.