Diff

spec/util_ringbuffer_spec.lua @ 10954:fc310727adfb

util.ringbuffer: Add some additional asserts to tests
author Matthew Wild <mwild1@gmail.com>
date Wed, 24 Jun 2020 13:00:11 +0100
parent 10953:c3b3ac63f4c3
child 10960:f84e0e2faae2
line wrap: on
line diff
--- a/spec/util_ringbuffer_spec.lua	Wed Jun 24 12:34:20 2020 +0100
+++ b/spec/util_ringbuffer_spec.lua	Wed Jun 24 13:00:11 2020 +0100
@@ -45,20 +45,20 @@
 
 		it("works", function ()
 			local b = rb.new();
-			b:write("hello world");
+			assert.truthy(b:write("hello world"));
 			assert.equals("hello", b:sub(1, 5));
 		end);
 
 		it("supports optional end parameter", function ()
 			local b = rb.new();
-			b:write("hello world");
+			assert.truthy(b:write("hello world"));
 			assert.equals("hello world", b:sub(1));
 			assert.equals("world", b:sub(-5));
 		end);
 
 		it("is equivalent to string:sub", function ()
 			local b = rb.new(6);
-			b:write("foobar");
+			assert.truthy(b:write("foobar"));
 			b:read(3);
 			b:write("foo");
 			for i = -13, 13 do
@@ -79,7 +79,7 @@
 
 		it("is equivalent to string:byte", function ()
 			local b = rb.new(6);
-			b:write("foobar");
+			assert.truthy(b:write("foo"..string.char(0, 140).."obar"));
 			b:read(3);
 			b:write("foo");
 			test_byte(b, 1);