Mercurial > prosody-hg
comparison spec/util_human_io_spec.lua @ 11200:bf8f2da84007
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 05 Nov 2020 22:31:25 +0100 |
| parents | 4d3247a1f6b3 |
| children | 93e9f7ae2f9b |
comparison
equal
deleted
inserted
replaced
| 11199:6c7c50a4de32 | 11200:bf8f2da84007 |
|---|---|
| 1 describe("util.human.io", function () | |
| 2 local human_io | |
| 3 setup(function () | |
| 4 human_io = require "util.human.io"; | |
| 5 end); | |
| 6 describe("table", function () | |
| 7 | |
| 8 it("alignment works", function () | |
| 9 local row = human_io.table({ | |
| 10 { | |
| 11 width = 3, | |
| 12 align = "right" | |
| 13 }, | |
| 14 { | |
| 15 width = 3, | |
| 16 }, | |
| 17 }); | |
| 18 | |
| 19 assert.equal(" 1 | . ", row({ 1, "." })); | |
| 20 assert.equal(" 10 | .. ", row({ 10, ".." })); | |
| 21 assert.equal("100 | ...", row({ 100, "..." })); | |
| 22 assert.equal("10… | ..…", row({ 1000, "...." })); | |
| 23 | |
| 24 end); | |
| 25 end); | |
| 26 end); | |
| 27 | |
| 28 | |
| 29 |
