Skip to content

Commit

Permalink
Make show tests pass again
Browse files Browse the repository at this point in the history
  • Loading branch information
chinarjoshi committed Sep 21, 2023
1 parent b1be82a commit 9740fd0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/subcmds/show.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ bool show_cmd(Cli *cli) {
// Include the global alias file if not 'local'
if (!s.local) {
FILE *alias_f = fopen(ALIAS_FNAME, "r");
if (!alias_f) {
perror("Error (file I/O): unable to open alias file: \"%s\".\n");
return false;
}
read_aliases(alias_f, ht, false);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/test_parse_args.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ START_TEST(test_parse_args_remove_all_flags) {
}

START_TEST(test_parse_args_show_normal) {
int argc = 4;
int argc = 2;
char *argv[] = { "acronym", "show" };
Cli *cli = parse_args(argc, argv);
ck_assert_int_eq(cli->type, SHOW);
Expand Down
2 changes: 2 additions & 0 deletions tests/test_subcmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ START_TEST(test_show_cmd_normal) {
.verbosity = 1,
};

const char *path = "/home/c/.aliases";
strncpy(ALIAS_FNAME, path, strlen(path));
ck_assert(show_cmd(&cli));
}
END_TEST
Expand Down

0 comments on commit 9740fd0

Please sign in to comment.