Line |
Branch |
Exec |
Source |
1 |
|
|
/* |
2 |
|
|
** EPITECH PROJECT, 2024 |
3 |
|
|
** 42sh |
4 |
|
|
** File description: |
5 |
|
|
** The parsing.ini |
6 |
|
|
*/ |
7 |
|
|
|
8 |
|
|
#include "criterion/criterion.h" |
9 |
|
|
#include "criterion/redirect.h" |
10 |
|
|
#include "../include/myshell.h" |
11 |
|
|
|
12 |
|
4 |
Test(parsing1, full_gcorv) |
13 |
|
|
{ |
14 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
15 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
16 |
|
|
|
17 |
|
2 |
fprintf(file, "exit\n"); |
18 |
|
2 |
fclose(file); |
19 |
|
2 |
freopen("test_input.txt", "r", stdin); |
20 |
|
2 |
shell(env); |
21 |
|
✗ |
} |
22 |
|
|
|
23 |
|
4 |
Test(parsing2, full_gcorv) |
24 |
|
|
{ |
25 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
26 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
27 |
|
|
|
28 |
|
2 |
fprintf(file, " ls \n"); |
29 |
|
2 |
fprintf(file, "exit\n"); |
30 |
|
2 |
fclose(file); |
31 |
|
2 |
freopen("test_input.txt", "r", stdin); |
32 |
|
2 |
shell(env); |
33 |
|
✗ |
} |
34 |
|
|
|
35 |
|
4 |
Test(parsing3, full_gcorv) |
36 |
|
|
{ |
37 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
38 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
39 |
|
|
|
40 |
|
2 |
fprintf(file, " \n"); |
41 |
|
2 |
fprintf(file, "exit\n"); |
42 |
|
2 |
fclose(file); |
43 |
|
2 |
freopen("test_input.txt", "r", stdin); |
44 |
|
2 |
shell(env); |
45 |
|
✗ |
} |
46 |
|
|
|
47 |
|
4 |
Test(parsing4, full_gcorv) |
48 |
|
|
{ |
49 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
50 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
51 |
|
|
|
52 |
|
2 |
fprintf(file, "\\t\n"); |
53 |
|
2 |
fprintf(file, "exit\n"); |
54 |
|
2 |
fclose(file); |
55 |
|
2 |
freopen("test_input.txt", "r", stdin); |
56 |
|
2 |
shell(env); |
57 |
|
✗ |
} |
58 |
|
|
|
59 |
|
4 |
Test(parsing5, full_gcorv) |
60 |
|
|
{ |
61 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
62 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
63 |
|
|
|
64 |
|
2 |
fprintf(file, "exit\n"); |
65 |
|
2 |
fclose(file); |
66 |
|
2 |
freopen("test_input.txt", "r", stdin); |
67 |
|
2 |
shell(env); |
68 |
|
✗ |
} |
69 |
|
|
|
70 |
|
4 |
Test(parsing6, full_gcorv) |
71 |
|
|
{ |
72 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
73 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
74 |
|
|
|
75 |
|
2 |
fprintf(file, "\"\n"); |
76 |
|
2 |
fprintf(file, "exit\n"); |
77 |
|
2 |
fclose(file); |
78 |
|
2 |
freopen("test_input.txt", "r", stdin); |
79 |
|
2 |
shell(env); |
80 |
|
✗ |
} |
81 |
|
|
|
82 |
|
4 |
Test(parsing7, full_gcorv) |
83 |
|
|
{ |
84 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
85 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
86 |
|
|
|
87 |
|
2 |
fprintf(file, "\"\"\n"); |
88 |
|
2 |
fprintf(file, "exit\n"); |
89 |
|
2 |
fclose(file); |
90 |
|
2 |
freopen("test_input.txt", "r", stdin); |
91 |
|
2 |
shell(env); |
92 |
|
✗ |
} |
93 |
|
|
|
94 |
|
4 |
Test(parsing8, full_gcorv) |
95 |
|
|
{ |
96 |
|
2 |
char **env = my_str_to_word_array_select("TERM=xterm ; PATH=/bin:/usr/bin", " ;"); |
97 |
|
2 |
FILE *file = fopen("test_input.txt", "w"); |
98 |
|
|
|
99 |
|
2 |
fprintf(file, "\n"); |
100 |
|
2 |
fprintf(file, "exit\n"); |
101 |
|
2 |
fclose(file); |
102 |
|
2 |
freopen("test_input.txt", "r", stdin); |
103 |
|
2 |
shell(env); |
104 |
|
✗ |
} |
105 |
|
|
|