Add CLI args parsing tests and lib target; fix summary string building
Introduce `src/lib.rs` and library target so integration tests can import `docx_mcp`. Add focused `tests/args_tests.rs` verifying clap flag/env parsing and `SecurityConfig::from_args`/`from_env`. Enable clap `env` feature and guard the binary behind a `build-bin` feature to allow testing without unresolved MCP server deps. Fix `get_summary` to build owned strings safely. These changes ensure argument options work correctly and are covered by comprehensive tests, independent of heavier integration suites.
This commit is contained in:
+7
-1
@@ -84,7 +84,7 @@ regex = "1.10"
|
||||
once_cell = "1.20"
|
||||
|
||||
# Command line argument parsing
|
||||
clap = { version = "4.5", features = ["derive"] }
|
||||
clap = { version = "4.5", features = ["derive", "env"] }
|
||||
|
||||
# Optional external tool support
|
||||
headless_chrome = { version = "1.0", optional = true }
|
||||
@@ -96,6 +96,7 @@ embedded-fonts = []
|
||||
pure-rust-pdf = []
|
||||
external-tools = ["headless_chrome", "wkhtmltopdf"]
|
||||
full = ["embedded-fonts", "pure-rust-pdf", "external-tools", "tera"]
|
||||
build-bin = []
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1.0"
|
||||
@@ -103,6 +104,11 @@ anyhow = "1.0"
|
||||
[[bin]]
|
||||
name = "docx-mcp"
|
||||
path = "src/main.rs"
|
||||
required-features = ["build-bin"]
|
||||
|
||||
[lib]
|
||||
name = "docx_mcp"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dev-dependencies]
|
||||
# Testing framework
|
||||
|
||||
Reference in New Issue
Block a user