-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.txt
97 lines (85 loc) · 3.08 KB
/
testing.txt
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
# Initial state check
pwd # Should show ~
ls # Should show empty or initial directory state
# Test mkdir
mkdir test_dir
mkdir documents
ls # Should show test_dir and documents
mkdir test_dir # Should fail - directory exists
# Test cd and pwd
cd test_dir
pwd # Should show ~/test_dir
cd ..
pwd # Should show ~
cd documents
pwd # Should show ~/documents
cd / # Test absolute path
pwd # Should show /
cd ~ # Test home directory shortcut
pwd # Should show ~
cd nonexistent # Should fail - no such directory
# Test touch and ls
touch file1.txt
touch file2.txt
touch file3.md
ls # Should show file1.txt, file2.txt, file3.md
touch file1.txt # Should update timestamp, not fail
# Test echo and cat
echo "Hello World" > file1.txt
cat file1.txt # Should show: Hello World
echo "Line 1" > file2.txt
echo " - Line 2" >> file2.txt
echo " - Line 3" >> file2.txt
cat file2.txt # Should show: Line 1 - Line 2 - Line 3
cat nonexistent.txt # Should fail - no such file
# Test mv
mv file1.txt renamed.txt
ls # Should show renamed.txt instead of file1.txt
cat renamed.txt # Should still show: Hello World
mv file2.txt file3.md # Should fail - destination exists
mv nonexistent.txt something.txt # Should fail - source doesn't exist
# Test rm
rm file3.md
ls # Should not show file3.md
mkdir temp_dir
touch temp_dir/temp.txt
rm temp_dir # Should fail - directory not empty
rm -r temp_dir # Should succeed
ls # Should not show temp_dir
rm renamed.txt file2.txt # Test multiple file removal
ls # Should show empty directory
# Test help
help # Should list all available commands with descriptions
# Test clear
clear # Should clear the terminal
# Final state verification
pwd # Should show current directory
ls # Should show current directory contents
# Test error cases for each command
cd "" # Should fail - no directory specified
mkdir "" # Should fail - no directory name specified
touch "" # Should fail - no filename specified
rm "" # Should fail - no file specified
cat "" # Should fail - no file specified
echo "" > "" # Should fail - no filename specified
mv "" "" # Should fail - no source/destination specified
# Test path navigation
cd /
pwd # Should show /
cd ~
pwd # Should show ~
mkdir a
cd a
mkdir b
cd b
pwd # Should show ~/a/b
cd ../..
pwd # Should show ~
# Test complex combinations
mkdir test
cd test
echo "test content" > test.txt
cat test.txt # Should show: test content
cd ..
rm -r test # Should remove directory and contents
ls # Should not show test directory