-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-modes.sh
More file actions
executable file
·35 lines (28 loc) · 1.15 KB
/
test-modes.sh
File metadata and controls
executable file
·35 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Test script for go-mod-select working directory modes
echo "Testing go-mod-select working directory modes"
echo "=============================================="
echo ""
# Test 1: Current directory (should find go.mod in current dir)
echo "Test 1: Default mode (current directory)"
./go-mod-select 1.25 --dry-run 2>&1 | head -5
echo ""
# Test 2: --dir with current directory
echo "Test 2: Using --dir with current directory"
./go-mod-select 1.25 --dir . --dry-run 2>&1 | head -5
echo ""
# Test 3: --gomod with explicit path
echo "Test 3: Using --gomod with explicit path"
./go-mod-select 1.25 --gomod ./go.mod --dry-run 2>&1 | head -5
echo ""
# Test 4: Non-existent directory (should error)
echo "Test 4: Non-existent directory (should error)"
./go-mod-select 1.25 --dir /nonexistent/path 2>&1 | grep -i "error\|not found"
echo ""
# Test 5: Priority test - both --dir and --gomod (gomod should win)
echo "Test 5: Priority test - both flags (gomod should win)"
echo "Using: --dir /tmp --gomod ./go.mod"
./go-mod-select 1.25 --dir /tmp --gomod ./go.mod --dry-run 2>&1 | head -5
echo ""
echo "=============================================="
echo "Tests completed"