-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
139 lines (123 loc) · 3.4 KB
/
test.sh
File metadata and controls
139 lines (123 loc) · 3.4 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
#############################################################################
# pyp C++ Virtual Environment Manager - Quick Test Script
# Test the installation and basic functionality
#############################################################################
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'
BOLD='\033[1m'
RESET='\033[0m'
echo -e "${BOLD}${GREEN}"
echo " Testing pyp Installation..."
echo -e "${RESET}"
# Check if pyp is installed
if ! command -v pyp &> /dev/null; then
echo -e "${RED}Error: pyp not found in PATH${RESET}"
echo "Please run install.sh first"
exit 1
fi
echo -e "${GREEN}[✓] pyp found in PATH${RESET}"
# Test version command
echo ""
echo -e "${BOLD}Testing version command...${RESET}"
pyp --version
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Version command works${RESET}"
else
echo -e "${RED}[✗] Version command failed${RESET}"
exit 1
fi
# Test help command
echo ""
echo -e "${BOLD}Testing help command...${RESET}"
pyp --help | head -5
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Help command works${RESET}"
else
echo -e "${RED}[✗] Help command failed${RESET}"
exit 1
fi
# Test list command
echo ""
echo -e "${BOLD}Testing list command...${RESET}"
pyp --list
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] List command works${RESET}"
else
echo -e "${RED}[✗] List command failed${RESET}"
exit 1
fi
# Test build command
echo ""
echo -e "${BOLD}Testing build command...${RESET}"
pyp -b test_env
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Build command works${RESET}"
else
echo -e "${RED}[✗] Build command failed${RESET}"
exit 1
fi
# Check if environment was created
if [ -d "test_env" ]; then
echo -e "${GREEN}[✓] Environment directory created${RESET}"
else
echo -e "${RED}[✗] Environment directory not found${RESET}"
exit 1
fi
# Test info command
echo ""
echo -e "${BOLD}Testing info command...${RESET}"
pyp -i test_env
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Info command works${RESET}"
else
echo -e "${RED}[✗] Info command failed${RESET}"
exit 1
fi
# Test activate command
echo ""
echo -e "${BOLD}Testing activate command...${RESET}"
pyp -a test_env | head -3
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Activate command works${RESET}"
else
echo -e "${RED}[✗] Activate command failed${RESET}"
exit 1
fi
# Test set-default command
echo ""
echo -e "${BOLD}Testing set-default command...${RESET}"
pyp --set-default test_env
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Set-default command works${RESET}"
else
echo -e "${RED}[✗] Set-default command failed${RESET}"
exit 1
fi
# Clean up test environment
echo ""
echo -e "${BOLD}Cleaning up test environment...${RESET}"
pyp --remove test_env --force
if [ $? -eq 0 ]; then
echo -e "${GREEN}[✓] Remove command works${RESET}"
else
echo -e "${RED}[✗] Remove command failed${RESET}"
exit 1
fi
# Check if environment was removed
if [ ! -d "test_env" ]; then
echo -e "${GREEN}[✓] Environment directory removed${RESET}"
else
echo -e "${RED}[✗] Environment directory still exists${RESET}"
exit 1
fi
echo ""
echo -e "${BOLD}${GREEN}========================================${RESET}"
echo -e "${BOLD}${GREEN} All Tests Passed!${RESET}"
echo -e "${BOLD}${GREEN}========================================${RESET}"
echo ""
echo -e "${BOLD}pyp is working correctly!${RESET}"
echo ""