Software /
code /
prosody
Comparison
spec/util_encodings_spec.lua @ 8372:872efae6e222
spec/util.encodings: Test an UTF-8 sequence
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 03 Nov 2017 15:44:39 +0100 |
parent | 8371:09a1ce618ad0 |
child | 8373:af7b41a0ec9e |
comparison
equal
deleted
inserted
replaced
8371:09a1ce618ad0 | 8372:872efae6e222 |
---|---|
6 describe("#encode()", function() | 6 describe("#encode()", function() |
7 it("should work", function () | 7 it("should work", function () |
8 assert.is.equal(encodings.base64.encode(""), ""); | 8 assert.is.equal(encodings.base64.encode(""), ""); |
9 assert.is.equal(encodings.base64.encode('coucou'), "Y291Y291"); | 9 assert.is.equal(encodings.base64.encode('coucou'), "Y291Y291"); |
10 assert.is.equal(encodings.base64.encode("\0\0\0"), "AAAA"); | 10 assert.is.equal(encodings.base64.encode("\0\0\0"), "AAAA"); |
11 assert.is.equal(encodings.base64.encode("\255\255\255"), "////"); | |
11 end); | 12 end); |
12 end); | 13 end); |
13 describe("#decode()", function() | 14 describe("#decode()", function() |
14 it("should work", function () | 15 it("should work", function () |
15 assert.is.equal(encodings.base64.decode(""), ""); | 16 assert.is.equal(encodings.base64.decode(""), ""); |
16 assert.is.equal(encodings.base64.decode('Y291Y291'), "coucou"); | 17 assert.is.equal(encodings.base64.decode('Y291Y291'), "coucou"); |
17 assert.is.equal(encodings.base64.decode("AAAA"), "\0\0\0"); | 18 assert.is.equal(encodings.base64.decode("AAAA"), "\0\0\0"); |
19 assert.is.equal(encodings.base64.decode("////"), "\255\255\255"); | |
18 end); | 20 end); |
19 end); | 21 end); |
20 end); | 22 end); |
21 describe("util.encodings.utf8", function() | 23 describe("util.encodings.utf8", function() |
22 describe("#valid()", function() | 24 describe("#valid()", function() |