build/test/quick_test.sh (view raw)
1#!/bin/bash
2
3# Quick version check test
4# Returns SUCCESS or FAILED
5
6echo "=== bibel Quick Version Check ==="
7
8# Change to project root
9cd "$(dirname "$0")/.." || exit 1
10
11# Check if binary exists and runs
12if [ ! -f ./bibel ]; then
13 echo "Building bibel..."
14 if ! go build -o ./bibel ./cmd/bibel.go; then
15 echo "FAILED: bibel build failed"
16 exit 1
17 fi
18fi
19
20# Test basic functionality
21if ! ./bibel --help >/dev/null 2>&1; then
22 echo "FAILED: bibel --help failed"
23 exit 1
24fi
25
26# Test reading modes
27for mode in evangelion new_testament old_testament bible; do
28 timeout 2 ./bibel --plain -r "$mode" >/dev/null 2>&1
29 exit_code=$?
30 # Exit code 124 is timeout (from TUI mode), 0 is success, others are errors
31 if [ $exit_code -ne 0 ] && [ $exit_code -ne 124 ]; then
32 echo "FAILED: Mode $mode not working (exit code: $exit_code)"
33 exit 1
34 fi
35done
36
37# Test output modes (skip TUI with --plain)
38for flag in --plain --formatted --numbered; do
39 ./bibel $flag -r evangelion >/dev/null 2>&1
40 if [ $? -ne 0 ]; then
41 echo "FAILED: Flag $flag not working"
42 exit 1
43 fi
44done
45
46echo "SUCCESS: All basic functionality working"
47exit 0