comparison spec/util_ringbuffer_spec.lua @ 10899:8048255ae61e

util.ringbuffer: Prevent creation of buffer with negative size Previously this would have been (unsigned)-1 which is a large positive integer.
author Kim Alvefur <zash@zash.se>
date Thu, 04 Jun 2020 16:11:08 +0200
parents c6465fb3c839
children 5e33926f4b43
comparison
equal deleted inserted replaced
10898:c6465fb3c839 10899:8048255ae61e
10 it("won't create an empty buffer", function () 10 it("won't create an empty buffer", function ()
11 assert.has_error(function () 11 assert.has_error(function ()
12 rb.new(0); 12 rb.new(0);
13 end); 13 end);
14 end); 14 end);
15 it("won't create a negatively sized buffer", function ()
16 assert.has_error(function ()
17 rb.new(-1);
18 end);
19 end);
15 end); 20 end);
16 describe(":write", function () 21 describe(":write", function ()
17 local b = rb.new(); 22 local b = rb.new();
18 it("works", function () 23 it("works", function ()
19 assert.truthy(b:write("hi")); 24 assert.truthy(b:write("hi"));