Comparison

spec/util_dbuffer_spec.lua @ 11156:a8ef69f7fc35 0.11

util.dbuffer: Expose length as :len() method, like strings Ref #1598
author Kim Alvefur <zash@zash.se>
date Mon, 12 Oct 2020 20:20:02 +0200
parent 11105:3c0940f3cf74
child 11158:3a72cb126d6c
comparison
equal deleted inserted replaced
11142:552cafd30eb2 11156:a8ef69f7fc35
40 local b = dbuffer.new(); 40 local b = dbuffer.new();
41 it("works", function () 41 it("works", function ()
42 assert.truthy(b:write("hello world")); 42 assert.truthy(b:write("hello world"));
43 assert.truthy(b:discard(6)); 43 assert.truthy(b:discard(6));
44 assert.equal(5, b:length()); 44 assert.equal(5, b:length());
45 assert.equal(5, b:len());
45 assert.equal("world", b:read(5)); 46 assert.equal("world", b:read(5));
46 end); 47 end);
47 end); 48 end);
48 49
49 describe(":collapse()", function () 50 describe(":collapse()", function ()