Compare commits
15 Commits
fix/issue-
...
860bf9295f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
860bf9295f | ||
|
|
fd79bfa3ea | ||
| 119c9b8fd9 | |||
|
|
7f7f8b1085 | ||
| 1a523a805a | |||
|
|
6aa84a35b9 | ||
| 6e2841bbda | |||
|
|
99d09c7dda | ||
| 383f538438 | |||
|
|
28b343f817 | ||
| 3a2095861f | |||
|
|
836fde07fc | ||
| 4f2a04e0b4 | |||
|
|
c8bb0b36f4 | ||
| 937b7c69de |
@@ -53,5 +53,9 @@ load_agent_env() {
|
||||
set -a
|
||||
source "$ENV_DIR/default.env"
|
||||
set +a
|
||||
elif [ -f "$ENV_DIR/pm-agent.env" ]; then
|
||||
set -a
|
||||
source "$ENV_DIR/pm-agent.env"
|
||||
set +a
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ process_task() {
|
||||
|
||||
source "$SCRIPT_DIR/kugetsu-session.sh"
|
||||
|
||||
if worktree_exists "$issue_ref" "$HOME/.kugetsu-worktrees" || [ -f "$SESSIONS_DIR/$(issue_ref_to_filename "$issue_ref").json" ]; then
|
||||
if worktree_exists "$issue_ref" "$WORKTREES_DIR" || [ -f "$SESSIONS_DIR/$(issue_ref_to_filename "$issue_ref").json" ]; then
|
||||
log_file="$LOGS_DIR/delegate-$(date +%s).log"
|
||||
if cmd_continue "$issue_ref" "$message" >> "$log_file" 2>&1; then
|
||||
sleep 1
|
||||
|
||||
@@ -58,6 +58,25 @@ EOF
|
||||
echo "Created config file: $KUGETSU_DIR/config"
|
||||
fi
|
||||
|
||||
mkdir -p "$ENV_DIR"
|
||||
if [ ! -f "$ENV_DIR/default.env" ]; then
|
||||
cat > "$ENV_DIR/default.env" << 'EOF'
|
||||
# Environment variables for agents
|
||||
# Copy this file to <agent-type>.env (e.g., pm-agent.env, dev.env)
|
||||
# and set your tokens and configuration
|
||||
|
||||
# Required: Gitea token for API access
|
||||
# GITEA_TOKEN=your_gitea_token_here
|
||||
|
||||
# Optional: GitHub token (if using GitHub)
|
||||
# GITHUB_TOKEN=your_github_token_here
|
||||
|
||||
# Optional: GitLab token (if using GitLab)
|
||||
# GITLAB_TOKEN=your_gitlab_token_here
|
||||
EOF
|
||||
echo "Created env template: $ENV_DIR/default.env"
|
||||
fi
|
||||
|
||||
local existing_base=$(get_base_session_id)
|
||||
local existing_pm=$(get_pm_agent_session_id)
|
||||
|
||||
@@ -194,11 +213,50 @@ cmd_delegate() {
|
||||
|
||||
mkdir -p "$LOGS_DIR"
|
||||
local log_file="$LOGS_DIR/delegate-$(date +%s).log"
|
||||
nohup sh -c "GITEA_TOKEN='***' opencode run '$message' --continue --session '$pm_session' >> '$log_file' 2>&1" > /dev/null 2>&1 &
|
||||
disown
|
||||
load_agent_env "pm-agent"
|
||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --continue --session '$pm_session'" >> "$log_file" 2>&1 &
|
||||
echo "Delegated to PM agent (logged to $(basename "$log_file"))"
|
||||
}
|
||||
|
||||
build_dev_agent_message() {
|
||||
local issue_ref="$1"
|
||||
local user_message="${2:-}"
|
||||
|
||||
local instance=$(echo "$issue_ref" | cut -d'/' -f1 | cut -d'#' -f1)
|
||||
local owner=$(echo "$issue_ref" | cut -d'/' -f2)
|
||||
local repo=$(echo "$issue_ref" | cut -d'/' -f3 | cut -d'#' -f1)
|
||||
local number=$(echo "$issue_ref" | grep -oE '#[0-9]+$' | tr -d '#')
|
||||
local worktree_path=$(issue_ref_to_worktree_path "$issue_ref")
|
||||
|
||||
local base_message="You are assigned to work on $issue_ref.
|
||||
|
||||
Workflow:
|
||||
1. Read the issue at $instance/$owner/$repo/issues/$number AND all comments on that issue
|
||||
2. Check if a PR already exists for this issue
|
||||
- If PR exists and is open, review it and learn from it
|
||||
- If PR makes sense to continue, work on it instead
|
||||
- If PR is not worth continuing, create a new branch/PR but explain in PR description why you're creating a new one instead of continuing the existing PR
|
||||
3. Read README.md (if exists) to understand the general concept of this repository
|
||||
4. Read CONTRIBUTING.md (if exists) to understand how to contribute
|
||||
- If CONTRIBUTING.md doesn't exist, follow steps 5-9 as your guideline
|
||||
5. Explore the repository to understand the codebase
|
||||
6. If anything is unclear, post a comment on the issue asking for clarification before implementing
|
||||
7. Implement the solution
|
||||
8. Create a branch named fix/issue-$number and implement the fix
|
||||
9. Create a PR when the implementation is complete
|
||||
|
||||
Work directory: $worktree_path"
|
||||
|
||||
if [ -n "$user_message" ]; then
|
||||
echo "$base_message
|
||||
|
||||
Additional instructions from delegator:
|
||||
$user_message"
|
||||
else
|
||||
echo "$base_message"
|
||||
fi
|
||||
}
|
||||
|
||||
cmd_start() {
|
||||
local issue_ref="${1:-}"
|
||||
local message="${2:-}"
|
||||
@@ -246,7 +304,7 @@ cmd_start() {
|
||||
local before_sessions=$(opencode session list 2>/dev/null | grep -oP '^ses_\w+' | sort)
|
||||
local before_set="|$before_sessions|"
|
||||
|
||||
create_worktree "$issue_ref"
|
||||
create_worktree "$issue_ref" "$WORKTREES_DIR"
|
||||
|
||||
local after_sessions=$(opencode session list 2>/dev/null | grep -oP '^ses_\w+' | sort)
|
||||
local new_session_id=""
|
||||
@@ -270,6 +328,13 @@ cmd_start() {
|
||||
|
||||
add_issue_to_index "$issue_ref" "$session_file"
|
||||
|
||||
local dev_message=$(build_dev_agent_message "$issue_ref" "$message")
|
||||
|
||||
load_agent_env "dev"
|
||||
|
||||
cd "$worktree_path"
|
||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$dev_message' --continue --session '$new_session_id'" >> "$LOGS_DIR/dev-$new_session_id.log" 2>&1 &
|
||||
|
||||
echo "Session started for '$issue_ref': $new_session_id"
|
||||
echo "Worktree: $worktree_path"
|
||||
}
|
||||
@@ -315,19 +380,17 @@ cmd_continue() {
|
||||
|
||||
local opencode_session_id=$(python3 -c "import json; print(json.load(open('$session_path')).get('opencode_session_id', ''))" 2>/dev/null || echo "")
|
||||
local worktree_path=$(python3 -c "import json; print(json.load(open('$session_path')).get('worktree_path', ''))" 2>/dev/null || echo "")
|
||||
local issue_ref=$(python3 -c "import json; print(json.load(open('$session_path')).get('issue_ref', ''))" 2>/dev/null || echo "")
|
||||
|
||||
if [ -z "$message" ]; then
|
||||
message=$(build_dev_agent_message "$issue_ref" "")
|
||||
fi
|
||||
|
||||
if [ -n "$worktree_path" ] && [ -d "$worktree_path" ]; then
|
||||
if [ -n "$message" ]; then
|
||||
(cd "$worktree_path" && opencode run "$message" --continue --session "$opencode_session_id" "$@")
|
||||
else
|
||||
(cd "$worktree_path" && opencode --continue --session "$opencode_session_id" "$@")
|
||||
fi
|
||||
cd "$worktree_path"
|
||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --continue --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 &
|
||||
else
|
||||
if [ -n "$message" ]; then
|
||||
opencode run "$message" --continue --session "$opencode_session_id" "$@"
|
||||
else
|
||||
opencode --continue --session "$opencode_session_id" "$@"
|
||||
fi
|
||||
nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --continue --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -479,11 +542,7 @@ cmd_destroy() {
|
||||
local target="${1:-}"
|
||||
local force=false
|
||||
|
||||
if [ "$target" = "--base" ]; then
|
||||
target=""
|
||||
fi
|
||||
|
||||
if [ "$2" = "-y" ]; then
|
||||
if [ "${2:-}" = "-y" ]; then
|
||||
force=true
|
||||
fi
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ get_repo_url() {
|
||||
fi
|
||||
|
||||
local instance=$(echo "$issue_ref" | cut -d'/' -f1 | cut -d'#' -f1)
|
||||
local rest=$(echo "$issue_ref" | sed 's/.*\///' | sed 's/#.*//')
|
||||
local rest=$(echo "$issue_ref" | sed 's/^[^\/]*\///' | sed 's/#.*//')
|
||||
|
||||
if [ -n "${GIT_SERVERS[$instance]:-}" ]; then
|
||||
echo "${GIT_SERVERS[$instance]}/${rest}.git"
|
||||
|
||||
298
skills/kugetsu/tests/test-git-url-parsing.sh
Normal file
298
skills/kugetsu/tests/test-git-url-parsing.sh
Normal file
@@ -0,0 +1,298 @@
|
||||
#!/bin/bash
|
||||
# Git URL Parsing Tests for kugetsu
|
||||
# Tests all functions that parse or construct git URLs and issue refs
|
||||
#
|
||||
# Run with: bash skills/kugetsu/tests/test-git-url-parsing.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/../scripts/kugetsu-config.sh"
|
||||
source "$SCRIPT_DIR/../scripts/kugetsu-worktree.sh"
|
||||
source "$SCRIPT_DIR/../scripts/kugetsu-session.sh"
|
||||
|
||||
PASS=0
|
||||
FAIL=0
|
||||
|
||||
pass() {
|
||||
echo "PASS: $1"
|
||||
PASS=$((PASS + 1))
|
||||
}
|
||||
|
||||
fail() {
|
||||
echo "FAIL: $1"
|
||||
echo " Expected: $2"
|
||||
echo " Got: $3"
|
||||
FAIL=$((FAIL + 1))
|
||||
}
|
||||
|
||||
echo "=== Git URL Parsing Test Suite ==="
|
||||
echo ""
|
||||
|
||||
# Test: get_repo_url with standard GitHub issue ref
|
||||
echo "--- Test: get_repo_url with github.com ---"
|
||||
result=$(get_repo_url "github.com/shoko/kugetsu#14")
|
||||
expected="https://github.com/shoko/kugetsu.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url standard github issue ref"
|
||||
else
|
||||
fail "get_repo_url standard github issue ref" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with custom instance
|
||||
echo "--- Test: get_repo_url with git.fbrns.co ---"
|
||||
result=$(get_repo_url "git.fbrns.co/shoko/kugetsu#158")
|
||||
expected="https://git.fbrns.co/shoko/kugetsu.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url custom instance issue ref (ISSUE #181)"
|
||||
else
|
||||
fail "get_repo_url custom instance issue ref (ISSUE #181)" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with gitlab.com (if configured)
|
||||
echo "--- Test: get_repo_url with gitlab.com ---"
|
||||
if [ -n "${GIT_SERVERS[gitlab.com]:-}" ]; then
|
||||
result=$(get_repo_url "gitlab.com/someuser/somerepo#42")
|
||||
expected="https://gitlab.com/someuser/somerepo.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url gitlab.com issue ref"
|
||||
else
|
||||
fail "get_repo_url gitlab.com issue ref" "$expected" "$result"
|
||||
fi
|
||||
else
|
||||
echo "SKIP: get_repo_url gitlab.com (not configured in GIT_SERVERS)"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with bitbucket.org (if configured)
|
||||
echo "--- Test: get_repo_url with bitbucket.org ---"
|
||||
if [ -n "${GIT_SERVERS[bitbucket.org]:-}" ]; then
|
||||
result=$(get_repo_url "bitbucket.org/myteam/myproject#7")
|
||||
expected="https://bitbucket.org/myteam/myproject.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url bitbucket.org issue ref"
|
||||
else
|
||||
fail "get_repo_url bitbucket.org issue ref" "$expected" "$result"
|
||||
fi
|
||||
else
|
||||
echo "SKIP: get_repo_url bitbucket.org (not configured in GIT_SERVERS)"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with large issue number
|
||||
echo "--- Test: get_repo_url with large issue number ---"
|
||||
result=$(get_repo_url "github.com/shoko/kugetsu#999999")
|
||||
expected="https://github.com/shoko/kugetsu.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url with large issue number"
|
||||
else
|
||||
fail "get_repo_url with large issue number" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_worktree_name standard
|
||||
echo "--- Test: issue_ref_to_worktree_name standard ---"
|
||||
result=$(issue_ref_to_worktree_name "github.com/shoko/kugetsu#14")
|
||||
expected="github.com-shoko-kugetsu-14"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_worktree_name standard"
|
||||
else
|
||||
fail "issue_ref_to_worktree_name standard" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_worktree_name with custom instance
|
||||
echo "--- Test: issue_ref_to_worktree_name custom instance ---"
|
||||
result=$(issue_ref_to_worktree_name "git.fbrns.co/shoko/kugetsu#158")
|
||||
expected="git.fbrns.co-shoko-kugetsu-158"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_worktree_name custom instance"
|
||||
else
|
||||
fail "issue_ref_to_worktree_name custom instance" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_branch_name with number
|
||||
echo "--- Test: issue_ref_to_branch_name with number ---"
|
||||
result=$(issue_ref_to_branch_name "github.com/shoko/kugetsu#14")
|
||||
expected="fix/issue-14"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_branch_name with number"
|
||||
else
|
||||
fail "issue_ref_to_branch_name with number" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_branch_name with discuss suffix
|
||||
# Note: #-discuss falls through to fix/issue-temp because #[^-]+$ doesn't match #-<text-with-hyphens>
|
||||
echo "--- Test: issue_ref_to_branch_name with discuss suffix ---"
|
||||
result=$(issue_ref_to_branch_name "github.com/shoko/kugetsu#-discuss")
|
||||
expected="fix/issue-temp"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_branch_name with discuss suffix"
|
||||
else
|
||||
fail "issue_ref_to_branch_name with discuss suffix" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_branch_name with identifier that has no hyphens
|
||||
echo "--- Test: issue_ref_to_branch_name with pure identifier ---"
|
||||
result=$(issue_ref_to_branch_name "github.com/shoko/kugetsu#someid")
|
||||
expected="fix/someid"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_branch_name with pure identifier"
|
||||
else
|
||||
fail "issue_ref_to_branch_name with pure identifier" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_branch_name without number
|
||||
echo "--- Test: issue_ref_to_branch_name without number ---"
|
||||
result=$(issue_ref_to_branch_name "github.com/shoko/kugetsu#abc")
|
||||
expected="fix/abc"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_branch_name without number"
|
||||
else
|
||||
fail "issue_ref_to_branch_name without number" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: extract_issue_ref_from_message with short form
|
||||
echo "--- Test: extract_issue_ref_from_message short form ---"
|
||||
result=$(extract_issue_ref_from_message "github.com/shoko/kugetsu#14")
|
||||
expected="github.com/shoko/kugetsu#14"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "extract_issue_ref_from_message short form"
|
||||
else
|
||||
fail "extract_issue_ref_from_message short form" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: extract_issue_ref_from_message with https URL
|
||||
echo "--- Test: extract_issue_ref_from_message with https URL ---"
|
||||
result=$(extract_issue_ref_from_message "https://github.com/shoko/kugetsu/issues/14")
|
||||
expected="github.com/shoko/kugetsu#14"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "extract_issue_ref_from_message with https URL"
|
||||
else
|
||||
fail "extract_issue_ref_from_message with https URL" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: extract_issue_ref_from_message with custom instance
|
||||
echo "--- Test: extract_issue_ref_from_message custom instance ---"
|
||||
result=$(extract_issue_ref_from_message "https://git.fbrns.co/shoko/kugetsu/issues/158")
|
||||
expected="git.fbrns.co/shoko/kugetsu#158"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "extract_issue_ref_from_message custom instance"
|
||||
else
|
||||
fail "extract_issue_ref_from_message custom instance" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: extract_issue_ref_from_message with empty message
|
||||
echo "--- Test: extract_issue_ref_from_message empty message ---"
|
||||
result=$(extract_issue_ref_from_message "")
|
||||
expected=""
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "extract_issue_ref_from_message empty message"
|
||||
else
|
||||
fail "extract_issue_ref_from_message empty message" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: extract_issue_ref_from_message with no issue ref
|
||||
echo "--- Test: extract_issue_ref_from_message no issue ref ---"
|
||||
result=$(extract_issue_ref_from_message "Just a regular message without any issue reference")
|
||||
expected=""
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "extract_issue_ref_from_message no issue ref"
|
||||
else
|
||||
fail "extract_issue_ref_from_message no issue ref" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: extract_issue_ref_from_message with gitlab URL
|
||||
echo "--- Test: extract_issue_ref_from_message gitlab URL ---"
|
||||
result=$(extract_issue_ref_from_message "https://gitlab.com/someuser/somerepo/issues/42")
|
||||
expected="gitlab.com/someuser/somerepo#42"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "extract_issue_ref_from_message gitlab URL"
|
||||
else
|
||||
fail "extract_issue_ref_from_message gitlab URL" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: validate_issue_ref valid format
|
||||
echo "--- Test: validate_issue_ref valid format ---"
|
||||
if validate_issue_ref "github.com/shoko/kugetsu#14" 2>/dev/null; then
|
||||
pass "validate_issue_ref valid format"
|
||||
else
|
||||
fail "validate_issue_ref valid format" "exit 0" "exit non-zero"
|
||||
fi
|
||||
|
||||
# Test: validate_issue_ref invalid format (missing parts)
|
||||
echo "--- Test: validate_issue_ref invalid format ---"
|
||||
if ! validate_issue_ref "invalid-ref" 2>/dev/null; then
|
||||
pass "validate_issue_ref invalid format"
|
||||
else
|
||||
fail "validate_issue_ref invalid format" "exit non-zero" "exit 0"
|
||||
fi
|
||||
|
||||
# Test: issue_ref_to_filename
|
||||
echo "--- Test: issue_ref_to_filename ---"
|
||||
result=$(issue_ref_to_filename "github.com/shoko/kugetsu#14")
|
||||
expected="github.com-shoko-kugetsu-14.json"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "issue_ref_to_filename"
|
||||
else
|
||||
fail "issue_ref_to_filename" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: filename_to_issue_ref
|
||||
echo "--- Test: filename_to_issue_ref ---"
|
||||
result=$(filename_to_issue_ref "github.com-shoko-kugetsu-14.json")
|
||||
expected="github.com/shoko/kugetsu#14"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "filename_to_issue_ref"
|
||||
else
|
||||
fail "filename_to_issue_ref" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with org having hyphen
|
||||
echo "--- Test: get_repo_url with hyphenated org ---"
|
||||
result=$(get_repo_url "github.com/my-org/my-repo#1")
|
||||
expected="https://github.com/my-org/my-repo.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url with hyphenated org"
|
||||
else
|
||||
fail "get_repo_url with hyphenated org" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with repo having dots
|
||||
echo "--- Test: get_repo_url with dotted repo ---"
|
||||
result=$(get_repo_url "github.com/shoko/kugetsu.utils#5")
|
||||
expected="https://github.com/shoko/kugetsu.utils.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url with dotted repo"
|
||||
else
|
||||
fail "get_repo_url with dotted repo" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with underscore in username
|
||||
echo "--- Test: get_repo_url with underscore in user ---"
|
||||
result=$(get_repo_url "github.com/my_user/my_repo#10")
|
||||
expected="https://github.com/my_user/my_repo.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url with underscore in user"
|
||||
else
|
||||
fail "get_repo_url with underscore in user" "$expected" "$result"
|
||||
fi
|
||||
|
||||
# Test: get_repo_url with instance not in GIT_SERVERS (fallback)
|
||||
echo "--- Test: get_repo_url with unknown instance ---"
|
||||
result=$(get_repo_url "unknown.example.com/owner/repo#1")
|
||||
expected="https://unknown.example.com/owner/repo.git"
|
||||
if [ "$result" = "$expected" ]; then
|
||||
pass "get_repo_url with unknown instance"
|
||||
else
|
||||
fail "get_repo_url with unknown instance" "$expected" "$result"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Test Results ==="
|
||||
echo "Passed: $PASS"
|
||||
echo "Failed: $FAIL"
|
||||
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "All tests passed!"
|
||||
exit 0
|
||||
else
|
||||
echo "Some tests failed!"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user