aboutsummaryrefslogtreecommitdiffstats
path: root/spec/util_queue_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'spec/util_queue_spec.lua')
-rw-r--r--spec/util_queue_spec.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/util_queue_spec.lua b/spec/util_queue_spec.lua
index d73f523d..d9e92e3d 100644
--- a/spec/util_queue_spec.lua
+++ b/spec/util_queue_spec.lua
@@ -137,4 +137,23 @@ describe("util.queue", function()
assert.equal(c, 6);
end);
end);
+ describe("replace()", function ()
+ it("should work", function ()
+ local q = queue.new(10);
+ for i = 1, 5 do
+ q:push(i);
+ end
+ q:replace(6);
+ local c = 0;
+ for i in q:consume() do
+ c = c + 1;
+ if c > 1 then
+ assert.is_equal(c, i);
+ elseif c == 1 then
+ assert.is_equal(6, i);
+ end
+ end
+ assert.is_equal(5, c);
+ end);
+ end);
end);