chore(release): prepare public source release
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
[package]
|
||||
name = "stringscan"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
authors.workspace = true
|
||||
readme.workspace = true
|
||||
publish.workspace = true
|
||||
description = "Extract and classify high-signal strings from opaque files."
|
||||
keywords.workspace = true
|
||||
categories.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
common = { path = "../common", default-features = false }
|
||||
lexopt.workspace = true
|
||||
serde.workspace = true
|
||||
|
||||
[dev-dependencies]
|
||||
assert_cmd.workspace = true
|
||||
predicates.workspace = true
|
||||
serde_json.workspace = true
|
||||
tempfile.workspace = true
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
||||
//! Binary entry point for `stringscan`.
|
||||
|
||||
fn main() {
|
||||
std::process::exit(stringscan::main_entry());
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
//! Integration tests for the `stringscan` command.
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
use assert_cmd::Command;
|
||||
use predicates::prelude::*;
|
||||
|
||||
fn cargo_command() -> Command {
|
||||
Command::cargo_bin("stringscan").expect("binary")
|
||||
}
|
||||
|
||||
fn workspace_root() -> PathBuf {
|
||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("..")
|
||||
.join("..")
|
||||
.canonicalize()
|
||||
.expect("workspace root")
|
||||
}
|
||||
|
||||
fn fixture_relative(path: &str) -> PathBuf {
|
||||
PathBuf::from("fixtures").join(path)
|
||||
}
|
||||
|
||||
fn fixture(path: &str) -> PathBuf {
|
||||
workspace_root().join(fixture_relative(path))
|
||||
}
|
||||
|
||||
fn relative_to_workspace(path: &str) -> String {
|
||||
fixture_relative(path).display().to_string()
|
||||
}
|
||||
|
||||
fn pwsh_command(script: impl AsRef<str>) -> Command {
|
||||
let mut command = Command::new("pwsh");
|
||||
command
|
||||
.arg("-NoProfile")
|
||||
.arg("-Command")
|
||||
.arg(script.as_ref());
|
||||
command
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn summarizes_high_signal_categories_in_text_mode() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.current_dir(workspace_root())
|
||||
.arg(fixture("binaries/stringscan-sample.bin"))
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("binary=true"))
|
||||
.stdout(predicate::str::contains(
|
||||
"categories=bepinex,dll,dotnet,il2cpp,namespace,path,unity,url",
|
||||
))
|
||||
.stdout(predicate::str::contains("matches="));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn filters_detail_output_by_kind() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.current_dir(workspace_root())
|
||||
.arg("--details")
|
||||
.arg("--kind")
|
||||
.arg("bepinex")
|
||||
.arg("--limit")
|
||||
.arg("2")
|
||||
.arg(fixture("binaries/stringscan-sample.bin"))
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("kind=bepinex"))
|
||||
.stdout(predicate::str::contains("BepInEx.Core"))
|
||||
.stdout(predicate::str::contains("Doorstop.Entrypoint"))
|
||||
.stdout(predicate::str::contains("kind=unity").not());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn emits_json_output_shape_for_filtered_matches() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.current_dir(workspace_root())
|
||||
.arg("--json")
|
||||
.arg("--kind")
|
||||
.arg("dll")
|
||||
.arg("--limit")
|
||||
.arg("1")
|
||||
.arg(fixture("binaries/stringscan-sample.bin"))
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("\"is_binary\":true"))
|
||||
.stdout(predicate::str::contains("\"string_count\":"))
|
||||
.stdout(predicate::str::contains("\"categories\":["))
|
||||
.stdout(predicate::str::contains("\"kind\":\"dll\""))
|
||||
.stdout(predicate::str::contains("\"value\":\"winhttp.dll\""))
|
||||
.stdout(predicate::str::contains("\"encoding\":\"ascii\""));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn supports_powershell_path_pipeline() {
|
||||
let binary = assert_cmd::cargo::cargo_bin("stringscan");
|
||||
let input = relative_to_workspace("binaries/stringscan-sample.bin");
|
||||
let script = format!("'{input}' | & '{}' --json --kind unity", binary.display());
|
||||
|
||||
let mut command = pwsh_command(script);
|
||||
command
|
||||
.current_dir(workspace_root())
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("\"kind\":\"unity\""))
|
||||
.stdout(predicate::str::contains(
|
||||
"\"value\":\"UnityEngine.CoreModule\"",
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn help_includes_detail_and_powershell_examples() {
|
||||
let mut command = cargo_command();
|
||||
command
|
||||
.arg("--help")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("--details"))
|
||||
.stdout(predicate::str::contains("ConvertFrom-Json"))
|
||||
.stdout(predicate::str::contains(
|
||||
"stringscan .\\fixtures\\binaries\\stringscan-sample.bin",
|
||||
));
|
||||
}
|
||||
Reference in New Issue
Block a user