-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·73 lines (56 loc) · 1.41 KB
/
test.sh
File metadata and controls
executable file
·73 lines (56 loc) · 1.41 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# Marchat Test Runner
# This script runs all tests in the Marchat project
set -e
echo "Running Marchat Test Suite"
echo "================================"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
echo -e "${GREEN}$1${NC}"
}
print_warning() {
echo -e "${YELLOW}$1${NC}"
}
print_error() {
echo -e "${RED}$1${NC}"
}
# Check if Go is installed
if ! command -v go &> /dev/null; then
print_error "Go is not installed or not in PATH"
exit 1
fi
# Check Go version
GO_VERSION=$(go version)
print_status "Using Go: $GO_VERSION"
# Run tests with verbose output
echo ""
echo "Running tests..."
echo "================="
# Run all tests
if go test ./...; then
echo ""
print_status "All tests passed!"
# Run test coverage
echo ""
echo "Generating test coverage report..."
echo "=================================="
go test -coverprofile=coverage.out ./...
go tool cover -html coverage.out -o coverage.html
print_status "Coverage report generated: coverage.html"
# Show coverage summary
echo ""
echo "Coverage Summary:"
echo "================="
go tool cover -func coverage.out | tail -1
echo ""
print_status "Test suite completed successfully!"
else
echo ""
print_error "Some tests failed!"
exit 1
fi