#!/bin/bash
set -euo pipefail
source "$(dirname "$0")/scripts/common.sh"
BUILD_DIR="build/tests"
HOST_ARCH="$(uname -m)"
TEST_BINARY="${BUILD_DIR}/MenuBrowserTests"
mkdir -p "${BUILD_DIR}"
# Only the units under test are compiled in — GlobalShortcut deliberately keeps the
# display helpers out of HotkeyManager so this stays free of Carbon and AppKit UI setup.
echo "Compiling tests..."
xcrun swiftc \
-target "${HOST_ARCH}-apple-macos${MIN_MACOS_VERSION}" \
-o "${TEST_BINARY}" \
Sources/URLRuleManager.swift \
Sources/GlobalShortcut.swift \
Tests/TestSupport.swift \
Tests/URLRuleManagerTests.swift \
Tests/GlobalShortcutTests.swift \
Tests/main.swift
echo "Running tests..."
"${TEST_BINARY}"
echo "Tests passed."