diff options
author | Thomas Harning Jr <harningt@gmail.com> | 2007-09-07 23:23:20 -0400 |
---|---|---|
committer | Thomas Harning Jr <harningt@gmail.com> | 2007-09-07 23:23:20 -0400 |
commit | 7640ff3de4854bd196b254ca190a40de9ebda5ad (patch) | |
tree | 6906ed0b57a5e9282c4f912549d2c2f4dc5e70d8 /src | |
parent | 453162a1f5c5322e873099802e57cca6295b4ffa (diff) | |
download | luaevent-prosody-7640ff3de4854bd196b254ca190a40de9ebda5ad.tar.gz luaevent-prosody-7640ff3de4854bd196b254ca190a40de9ebda5ad.zip |
Learned event_buffer tests and added failure for 'add' if no args passed.
lunit-based unit tests for event_buffer have been added. They are currently not complete
but are in the works to help manage corner cases/etc. These should also get behaviors
well-defined.
Diffstat (limited to 'src')
-rw-r--r-- | src/event_buffer.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/event_buffer.c b/src/event_buffer.c index 4d65273..110a41c 100644 --- a/src/event_buffer.c +++ b/src/event_buffer.c @@ -68,6 +68,7 @@ static int event_buffer_gc(lua_State* L) { progressively adds items to the buffer if arg[*] is string, treat as a string:format call if arg[*] is a buffer, perform event_add_buffer + expects at least 1 other argument returns number of bytes added */ static int event_buffer_add(lua_State* L) { @@ -76,6 +77,7 @@ static int event_buffer_add(lua_State* L) { int oldLength = EVBUFFER_LENGTH(buffer); int last = lua_gettop(L); int i; + if(last == 1) luaL_error(L, "Not enough arguments to add: expects at least 1 additional operand"); for(i = 2; i <= last; i++) { if(!lua_isstring(L, i) && !is_event_buffer(L, i)) luaL_argerror(L, i, "Argument is not a string or buffer object"); |