Comments (6)
https://github.com/RazrFalcon/pico-args/blob/master/tests/tests.rs ?
from pico-args.
like https://github.com/RazrFalcon/pico-args/blob/master/examples/app.rs how to do unit test test_parse_args or only way test one by one in file?
from pico-args.
I'm sorry, but I do not understand the question.
from pico-args.
how to make unit test for parse_args function in example from the repo? or just do your way and test separate args
from pico-args.
The parse_args
function doesn't have any logic that should be tested. If you really want to, you simply have to manually pass args into it. Like so:
fn parse_args(args: Vec<std::ffi::OsString>) -> Result<AppArgs, pico_args::Error> {
let mut pargs = pico_args::Arguments::from_vec();
// other stuff
}
#[cfg(test)]
mod tests {
fn to_vec(args: &[&str]) -> Vec<OsString> {
args.iter().map(|s| s.to_string().into()).collect()
}
#[test]
fn test() {
let args = super::parse_args(to_vec(&["--version"]));
// asserts...
}
}
from pico-args.
thx
from pico-args.
Related Issues (20)
- Example with subcommands that take arguements HOT 10
- Custom Error per subcommand HOT 9
- Are the `debug_asserts` important? HOT 2
- Make the = separator optional
- Forbid flags between options. HOT 13
- Multiple value arguments HOT 2
- Optional space between key and value HOT 4
- Implement Iterator for Arguments HOT 3
- Add support for -- arguments HOT 5
- Ignore unused arguments
- Consider all arguments after "--" free arguments HOT 3
- option aliases or additional short or long forms? HOT 2
- Combined flags question HOT 2
- Repeated args HOT 1
- Measure incremental build time HOT 3
- Confusing Display output for *ArgumentParsingFailed errors HOT 2
- musl+gcompat error HOT 6
- Inconsistent docs -- are combined arguments supported? HOT 1
- 1.0.0 HOT 1
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 pico-args.