| 75 | } |
| 76 | |
| 77 | void test_reftable_stack__read_file(void) |
| 78 | { |
| 79 | char *fn = get_tmp_template(__LINE__); |
| 80 | struct tempfile *tmp = mks_tempfile(fn); |
| 81 | int fd = get_tempfile_fd(tmp); |
| 82 | char out[1024] = "line1\n\nline2\nline3"; |
| 83 | int n, err; |
| 84 | char **names = NULL; |
| 85 | const char *want[] = { "line1", "line2", "line3" }; |
| 86 | |
| 87 | cl_assert(fd > 0); |
| 88 | n = write_in_full(fd, out, strlen(out)); |
| 89 | cl_assert_equal_i(n, strlen(out)); |
| 90 | err = close(fd); |
| 91 | cl_assert(err >= 0); |
| 92 | |
| 93 | err = read_lines(fn, &names); |
| 94 | cl_assert(!err); |
| 95 | |
| 96 | for (size_t i = 0; names[i]; i++) |
| 97 | cl_assert_equal_s(want[i], names[i]); |
| 98 | free_names(names); |
| 99 | (void) remove(fn); |
| 100 | delete_tempfile(&tmp); |
| 101 | } |
| 102 | |
| 103 | static int write_test_ref(struct reftable_writer *wr, void *arg) |
| 104 | { |
nothing calls this directly
no test coverage detected