Annotate

spec/util_dbuffer_spec.lua @ 12028:9ab202e942f5

MUC: Fix error origin JID in wrong argument position Mistake introduced in cbe524ed1a6a. Removing because this is a query to the bare JID where the error origin matches the resulting stanza 'from'.
author Kim Alvefur <zash@zash.se>
date Wed, 08 Dec 2021 21:06:16 +0100
parent 11637:19cddf92fcc2
child 12764:bf6d2f9fad4d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11105
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 local dbuffer = require "util.dbuffer";
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2 describe("util.dbuffer", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 describe("#new", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 it("has a constructor", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5 assert.Function(dbuffer.new);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 it("can be created", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8 assert.truthy(dbuffer.new());
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 it("won't create an empty buffer", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11 assert.falsy(dbuffer.new(0));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13 it("won't create a negatively sized buffer", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 assert.falsy(dbuffer.new(-1));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 describe(":write", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 it("works", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 assert.truthy(b:write("hi"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24 describe(":read", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 it("supports optional bytes parameter", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26 -- should return the frontmost chunk
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 assert.truthy(b:write("hello"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 assert.truthy(b:write(" "));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 assert.truthy(b:write("world"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31 assert.equal("h", b:read(1));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 assert.equal("ello", b:read());
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 assert.equal(" ", b:read());
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35 assert.equal("world", b:read());
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38
11636
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
39 describe(":read_until", function ()
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
40 it("works", function ()
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
41 local b = dbuffer.new();
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
42 b:write("hello\n");
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
43 b:write("world");
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
44 b:write("\n");
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
45 b:write("\n\n");
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
46 b:write("stuff");
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
47 b:write("more\nand more");
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
48
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
49 assert.equal(nil, b:read_until("."));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
50 assert.equal(nil, b:read_until("%"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
51 assert.equal("hello\n", b:read_until("\n"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
52 assert.equal("world\n", b:read_until("\n"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
53 assert.equal("\n", b:read_until("\n"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
54 assert.equal("\n", b:read_until("\n"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
55 assert.equal("stu", b:read(3));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
56 assert.equal("ffmore\n", b:read_until("\n"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
57 assert.equal(nil, b:read_until("\n"));
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
58 assert.equal("and more", b:read_chunk());
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
59 end);
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
60 end);
11e0a0a08da3 util.dbuffer: Add read_until() method
Matthew Wild <mwild1@gmail.com>
parents: 11158
diff changeset
61
11105
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
62 describe(":discard", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
63 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
64 it("works", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
65 assert.truthy(b:write("hello world"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
66 assert.truthy(b:discard(6));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
67 assert.equal(5, b:length());
11156
a8ef69f7fc35 util.dbuffer: Expose length as :len() method, like strings
Kim Alvefur <zash@zash.se>
parents: 11105
diff changeset
68 assert.equal(5, b:len());
11105
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
69 assert.equal("world", b:read(5));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
70 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
71 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
72
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
73 describe(":collapse()", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
74 it("works on an empty buffer", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
75 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
76 b:collapse();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
77 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
78 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
79
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
80 describe(":sub", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
81 -- Helper function to compare buffer:sub() with string:sub()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
82 local s = "hello world";
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
83 local function test_sub(b, x, y)
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
84 local string_result, buffer_result = s:sub(x, y), b:sub(x, y);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
85 assert.equals(string_result, buffer_result, ("buffer:sub(%d, %s) does not match string:sub()"):format(x, y and ("%d"):format(y) or "nil"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
86 end
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
87
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
88 it("works", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
89 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
90 assert.truthy(b:write("hello world"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
91 assert.equals("hello", b:sub(1, 5));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
92 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
93
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
94 it("works after discard", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
95 local b = dbuffer.new(256);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
96 assert.truthy(b:write("foobar"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
97 assert.equals("foobar", b:sub(1, 6));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
98 assert.truthy(b:discard(3)); -- consume "foo"
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
99 assert.equals("bar", b:sub(1, 3));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
100 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
101
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
102 it("supports optional end parameter", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
103 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
104 assert.truthy(b:write("hello world"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
105 assert.equals("hello world", b:sub(1));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
106 assert.equals("world", b:sub(-5));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
107 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
108
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
109 it("is equivalent to string:sub", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
110 local b = dbuffer.new(11);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
111 assert.truthy(b:write(s));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
112 for i = -13, 13 do
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
113 for j = -13, 13 do
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
114 test_sub(b, i, j);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
115 end
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
116 end
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
117 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
118 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
119
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
120 describe(":byte", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
121 -- Helper function to compare buffer:byte() with string:byte()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
122 local s = "hello world"
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
123 local function test_byte(b, x, y)
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
124 local string_result, buffer_result = {s:byte(x, y)}, {b:byte(x, y)};
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
125 assert.same(string_result, buffer_result, ("buffer:byte(%d, %s) does not match string:byte()"):format(x, y and ("%d"):format(y) or "nil"));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
126 end
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
127
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
128 it("is equivalent to string:byte", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
129 local b = dbuffer.new(11);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
130 assert.truthy(b:write(s));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
131 test_byte(b, 1);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
132 test_byte(b, 3);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
133 test_byte(b, -1);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
134 test_byte(b, -3);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
135 for i = -13, 13 do
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
136 for j = -13, 13 do
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
137 test_byte(b, i, j);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
138 end
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
139 end
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
140 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
141
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
142 it("works with characters > 127", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
143 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
144 b:write(string.char(0, 140));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
145 local r = { b:byte(1, 2) };
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
146 assert.same({ 0, 140 }, r);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
147 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
148
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
149 it("works on an empty buffer", function ()
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
150 local b = dbuffer.new();
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
151 assert.equal("", b:sub(1,1));
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
152 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
153 end);
3c0940f3cf74 util.dbuffer: Simplify test case
Kim Alvefur <zash@zash.se>
parents:
diff changeset
154 end);