Comments (5)
Thanks for the followup mention.
I plan on taking a look at implementing this, but likely wouldn't be until next weekend.
from cargo-mutants.
@danjl1100 no obligation, but if you want to take this one let me know.
from cargo-mutants.
My initial thoughts, any guiding feedback is welcome:
- Thinking to use the same
testdata/nested_mod
test case, and add all the examples listed in the rust reference you linked. Possibly add more levels of nesting too, so it's fairly exhaustive. - Introduce a new struct (
ModNamespace
?) to contain thename
and optionalpath
for each module in themod_namespace_stack: Vec<ModNamespace>
from cargo-mutants.
On further look, only the path to the module (not the module name identifiers) are used in find_mod_source
. I am thinking an extra struct is not needed: the separation from namespace_stack
(all rust identifiers) means that mod_namespace_stack
can contain just the filesystem names for the modules (without carrying around name
as well).
Though it may be helpful to add a struct FilesystemName(String)
newtype wrapper to ensure we're acknowledging it's a path and not an identifier? (otherwise, may be unclear on a quick skim that the different Vec<String>
fields are tracking subtly different values...)
UPDATE: mod_name
is output by the warn!
, do we want to keep the module name around for that purpose alone?
Line 497 in 3259d77
from cargo-mutants.
Using the same test case but with some addition modules containing #[path]
attributes sounds good.
Even though it's not really a security boundary we should check that paths don't contain ..
or /
.
Though it may be helpful to add a struct
FilesystemName(String)
newtype wrapper to ensure we're acknowledging it's a path and not an identifier?
Yes, the Vec<Vec<String>>
feels a bit loose. Though, on the other hand, maybe it should just be a Utf8PathBuf
which is basically like a FilesystemName(String)
: a stack holding the relative directory we'll search, and then the visitor can accumulate the paths of actual modules we need to later find. Then we need to translate a/b/c
to either a/b/c.rs
or a/b/c/mod.rs
unless we had a specific path
for c
, but there's already some code like that.
Regarding the "not found" message:
- Maybe that should be upgraded to an error rather than warning, and cause a non-zero exit.
- Maybe the more useful thing there would be to remember and report not just the mod name but the source file/line/col of the
mod
statement.
Also, I think this bug is some additional evidence for the refactor considered in #329 of separating walking mods from generating mutants, but that might be large so I'd rather do it myself. It shouldn't block or conflict with this.
from cargo-mutants.
Related Issues (20)
- Support #[mutants::skip] attribute on more statements
- `.ignore` files can exclude files that should be copied HOT 7
- Mutating const functions can cause the build to hang HOT 10
- Document `--timeout-multiplier` HOT 2
- Delete fields from struct literals that have a base (default) expression
- Module file path incorrect when nested under `mod` block HOT 3
- Separate finding modules from generating mutants?
- Write one consolidated output json
- Clean warning and success if the `--in-diff` diff file is empty?
- panic at `src/lab.rs:134:26` when interrupted
- 'impl trait' representation in mutant names can be wrong vs Rust source
- CI job that tests against some interesting/popular open source trees
- Try using a build profile that is quick but has no debug symbols
- More detail in CONTRIBUTING.md or the book about how to add new patterns
- Automatically merge results from multiple sharded jobs
- Test that requires copying `.git` HOT 3
- Support more cargo test flags HOT 2
- cargo-mutants doesn't work on tarpaulin tree HOT 1
- Check up on Debian packaging
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-mutants.