Skip to content

Commit

Permalink
Added a test for open with an invalid mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Jan 2, 2018
1 parent b801318 commit 3df7c2d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/b6b_test_file.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* This file is part of b6b.
*
* Copyright 2017 Dima Krasner
* Copyright 2017, 2018 Dima Krasner
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,6 +55,18 @@ int main()
struct b6b_interp interp;
size_t i;

assert(b6b_interp_new_argv(&interp, 0, NULL, B6B_OPT_TRACE));
assert(b6b_call_copy(&interp,
"{$open /dev/zero r}",
19) == B6B_OK);
b6b_interp_destroy(&interp);

assert(b6b_interp_new_argv(&interp, 0, NULL, B6B_OPT_TRACE));
assert(b6b_call_copy(&interp,
"{$open /dev/zero x}",
19) == B6B_ERR);
b6b_interp_destroy(&interp);

assert((unlink("/tmp/.file") == 0) || (errno == ENOENT));
assert(b6b_interp_new_argv(&interp, 0, NULL, B6B_OPT_TRACE));
assert(b6b_call_copy(&interp,
Expand Down

0 comments on commit 3df7c2d

Please sign in to comment.