mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Comprehensive rename of all openclaw references to hanzo-bot equivalents: - Package: openclaw → @hanzo/bot - Binary: openclaw → hanzo-bot - Types: OpenClaw* → Bot* - Env vars: OPENCLAW_* → BOT_* - Android: ai.openclaw.android → ai.hanzo.bot.android - iOS/macOS: ai.openclaw.* → ai.hanzo.* - Swift modules: OpenClaw* → Bot* - Plugins: openclaw.plugin.json → bot.plugin.json - Paths: .openclaw/ → .hanzo/bot/ - URLs: github.com/openclaw → github.com/hanzoai
50 lines
1.8 KiB
Swift
50 lines
1.8 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import HanzoBot
|
|
|
|
struct ExecAllowlistTests {
|
|
@Test func matchUsesResolvedPath() {
|
|
let entry = ExecAllowlistEntry(pattern: "/opt/homebrew/bin/rg")
|
|
let resolution = ExecCommandResolution(
|
|
rawExecutable: "rg",
|
|
resolvedPath: "/opt/homebrew/bin/rg",
|
|
executableName: "rg",
|
|
cwd: nil)
|
|
let match = ExecAllowlistMatcher.match(entries: [entry], resolution: resolution)
|
|
#expect(match?.pattern == entry.pattern)
|
|
}
|
|
|
|
@Test func matchUsesBasenameForSimplePattern() {
|
|
let entry = ExecAllowlistEntry(pattern: "rg")
|
|
let resolution = ExecCommandResolution(
|
|
rawExecutable: "rg",
|
|
resolvedPath: "/opt/homebrew/bin/rg",
|
|
executableName: "rg",
|
|
cwd: nil)
|
|
let match = ExecAllowlistMatcher.match(entries: [entry], resolution: resolution)
|
|
#expect(match?.pattern == entry.pattern)
|
|
}
|
|
|
|
@Test func matchIsCaseInsensitive() {
|
|
let entry = ExecAllowlistEntry(pattern: "RG")
|
|
let resolution = ExecCommandResolution(
|
|
rawExecutable: "rg",
|
|
resolvedPath: "/opt/homebrew/bin/rg",
|
|
executableName: "rg",
|
|
cwd: nil)
|
|
let match = ExecAllowlistMatcher.match(entries: [entry], resolution: resolution)
|
|
#expect(match?.pattern == entry.pattern)
|
|
}
|
|
|
|
@Test func matchSupportsGlobStar() {
|
|
let entry = ExecAllowlistEntry(pattern: "/opt/**/rg")
|
|
let resolution = ExecCommandResolution(
|
|
rawExecutable: "rg",
|
|
resolvedPath: "/opt/homebrew/bin/rg",
|
|
executableName: "rg",
|
|
cwd: nil)
|
|
let match = ExecAllowlistMatcher.match(entries: [entry], resolution: resolution)
|
|
#expect(match?.pattern == entry.pattern)
|
|
}
|
|
}
|