-
-#[cargo_test]
-fn cli_path() {
- // --config path_to_file
- fs::write(paths::root().join("myconfig.toml"), "key = 123").unwrap();
- let config = ConfigBuilder::new()
- .cwd(paths::root())
- .unstable_flag("config-include")
- .config_arg("myconfig.toml")
- .build();
- assert_eq!(config.get::<u32>("key").unwrap(), 123);
-
- let config = ConfigBuilder::new()
- .unstable_flag("config-include")
- .config_arg("missing.toml")
- .build_err();
- assert_error(
- config.unwrap_err(),
- "\
-failed to parse value from --config argument `missing.toml` as a dotted key expression
-
-Caused by:
- TOML parse error at line 1, column 13
- |
-1 | missing.toml
- | ^
-Unexpected end of input
-Expected `.` or `=`
-",
- );
-}