Skip to content

Commit

Permalink
test<dot_test>: adding new test for dot
Browse files Browse the repository at this point in the history
  • Loading branch information
majerugo committed Jan 26, 2024
1 parent 776937b commit f8528cd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/execute/utils/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ int check_file(struct ast_node *node, char *first_arg, char *path)
free(first_arg);
node->children[0]->value = path;
fclose(file);
return 1;
return 126;
}
fclose(file);

Expand Down Expand Up @@ -332,9 +332,12 @@ int dot_fun(struct ast_node *node)
{
return return_val;
}
if (doted && check_file(node, first_arg, path) == 1)

if (doted)
{
return 1;
int r = check_file(node, first_arg, path);
if (r != 0)
return r;
}
if (!doted)
free(path);
Expand Down
1 change: 1 addition & 0 deletions tests/builtin/cd/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ run_test cd_simple_test7.test

run_test cd_complex_test1.test
run_test cd_complex_test2.test
run_test cd_complex_test3.test

run_test cd_error_test1.test
run_test cd_error_test2.test
1 change: 1 addition & 0 deletions tests/builtin/dot/dot_complex_test4.test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a=test.sh;b=lpdl; . ../dot/$a; ./$a; . $a; . ../dot/$b $a; . ../dot/$a $b
7 changes: 6 additions & 1 deletion tests/builtin/dot/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ run_test dot_simple_test2.test
run_test dot_simple_test3.test
run_test dot_simple_test4.test
run_test dot_simple_test5.test

run_test dot_complex_test1.test
run_test dot_complex_test2.test
run_test dot_complex_test2.test
run_test dot_complex_test3.test
run_test dot_complex_test4.test

run_test dot_error_test1.test

0 comments on commit f8528cd

Please sign in to comment.