Do some work on redbean

- Rewrite Slurp() API to be like string.sub()
- Introduce a new Barf() API for creating files
- Update Redbean `-S` sandbox flag to do unveiling
This commit is contained in:
Justine Tunney 2022-07-22 20:44:24 -07:00
parent 742251dd92
commit 48ce3ad7cc
9 changed files with 296 additions and 33 deletions

View file

@ -29,13 +29,13 @@ __attribute__((__constructor__)) static void init(void) {
errno = 0;
}
TEST(dog, testReadPastEof_returnsZero) {
TEST(pread, testReadPastEof_returnsZero) {
EXPECT_NE(-1, (fd = open("a", O_RDWR | O_CREAT | O_TRUNC, 0644)));
EXPECT_EQ(0, pread(fd, buf, 8, 0));
EXPECT_EQ(0, close(fd));
}
TEST(dog, testReadOverlapsEof_returnsShortNumber) {
TEST(pread, testReadOverlapsEof_returnsShortNumber) {
EXPECT_NE(-1, (fd = open("b", O_RDWR | O_CREAT | O_TRUNC, 0644)));
EXPECT_EQ(4, pwrite(fd, buf, 4, 0));
EXPECT_EQ(4, pread(fd, buf, 8, 0));