.PHONY: help test test-quick test-core test-config test-debug test-all clean lint fmt check
help:
@echo "XQPath 测试管理"
@echo ""
@echo "可用命令:"
@echo " test-quick 快速测试 (核心功能)"
@echo " test-core 核心功能测试"
@echo " test-config 配置管理测试"
@echo " test-debug 调试功能测试"
@echo " test-all 所有测试"
@echo " test-perf 性能测试"
@echo ""
@echo "代码质量:"
@echo " check 语法检查"
@echo " lint 代码检查"
@echo " fmt 代码格式化"
@echo ""
@echo "构建管理:"
@echo " build 构建项目"
@echo " clean 清理构建文件"
@echo " release 发布构建"
test-quick:
@echo "🚀 运行快速测试..."
@cargo test --lib --test integration --test config_debug_features \
--features config-management,interactive-debug \
--quiet
test-core:
@echo "🔧 运行核心功能测试..."
@cargo test --lib --test integration
test-config:
@echo "⚙️ 运行配置管理测试..."
@cargo test --test config_debug_features --features config-management \
--quiet -- --test-threads=1
test-debug:
@echo "🐛 运行调试功能测试..."
@cargo test --test config_debug_features --features interactive-debug \
--quiet -- --test-threads=1
test-all:
@echo "🧪 运行所有测试..."
@cargo test --all --features config-management,interactive-debug
test-perf:
@echo "⚡ 运行性能测试..."
@cargo bench --features config-management,interactive-debug 2>/dev/null || \
echo "性能测试需要 nightly Rust 或 criterion feature"
test-stats:
@echo "📊 测试统计信息:"
@echo "文件数量: $$(find tests/ -name '*.rs' | wc -l)"
@echo "代码行数: $$(find tests/ -name '*.rs' -exec cat {} \; | wc -l)"
@echo "测试用例: $$(cargo test --features config-management,interactive-debug -- --list 2>/dev/null | grep -c 'test ' || echo '0')"
check:
@echo "🔍 语法检查..."
@cargo check --all-features
lint:
@echo "📋 代码检查..."
@cargo clippy --all-features -- -D warnings
fmt:
@echo "🎨 代码格式化..."
@cargo fmt --all
build:
@echo "🔨 构建项目..."
@cargo build --all-features
release:
@echo "📦 发布构建..."
@cargo build --release --all-features
clean:
@echo "🧹 清理构建文件..."
@cargo clean
@rm -rf target/
dev-check: fmt lint check test-quick
@echo "✅ 开发环境检查完成!"
ci-check: check lint test-all
@echo "✅ CI检查完成!"
pre-release: ci-check test-perf test-stats
@echo "✅ 发布前检查完成!"
test:
@./scripts/test-runner.sh quick --fast