ithewei / ithewei/libhv

need a test part for homebrew to merge it to homebrew-core

Open
#687 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
7.6k
Forks
1.4k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

add homebrew formula now
```
brew install cxwx/cxbrew/libhv
```

but it need the `test` part for merge to homebrew-core
like

```
test do
(testpath/"test.c").write <<~C
/* Wait for stdin to become readable, then read and echo the first line. */

#include
#include
#include
#include

ev_io stdin_watcher;

static void stdin_cb (EV_P_ ev_io *watcher, int revents) {
char *buf;
size_t nbytes = 255;
buf = (char *)malloc(nbytes + 1);
getline(&buf, &nbytes, stdin);
printf("%s", buf);
ev_io_stop(EV_A_ watcher);
ev_break(EV_A_ EVBREAK_ALL);
}

int main() {
ev_io_init(&stdin_watcher, stdin_cb, STDIN_FILENO, EV_READ);
ev_io_start(EV_DEFAULT, &stdin_watcher);
ev_run(EV_DEFAULT, 0);
return 0;
}
C
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lev", "-o", "test"
input = "hello, world\n"
assert_equal input, pipe_output("./test", input, 0)
end
end
```

![Image](https://github.com/user-attachments/assets/024827ee-c06a-4c53-a113-1a5078947684)

can somebody help?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.