util.x509: Nameprep commonName once
[prosody.git] / spec / net_websocket_frames_spec.lua
blobd4df3a548b50197b2c1033afafe6af0647d082bb
1 describe("net.websocket.frames", function ()
2 local nwf = require "net.websocket.frames";
4 local test_frames = {
5 simple_empty = {
6 ["opcode"] = 0;
7 ["length"] = 0;
8 ["data"] = "";
9 ["FIN"] = false;
10 ["MASK"] = false;
11 ["RSV1"] = false;
12 ["RSV2"] = false;
13 ["RSV3"] = false;
15 simple_data = {
16 ["opcode"] = 0;
17 ["length"] = 5;
18 ["data"] = "hello";
19 ["FIN"] = false;
20 ["MASK"] = false;
21 ["RSV1"] = false;
22 ["RSV2"] = false;
23 ["RSV3"] = false;
25 simple_fin = {
26 ["opcode"] = 0;
27 ["length"] = 0;
28 ["data"] = "";
29 ["FIN"] = true;
30 ["MASK"] = false;
31 ["RSV1"] = false;
32 ["RSV2"] = false;
33 ["RSV3"] = false;
37 describe("build", function ()
38 local build = nwf.build;
39 it("works", function ()
40 assert.equal("\0\0", build(test_frames.simple_empty));
41 assert.equal("\0\5hello", build(test_frames.simple_data));
42 assert.equal("\128\0", build(test_frames.simple_fin));
43 end);
44 end);
46 describe("parse", function ()
47 local parse = nwf.parse;
48 it("works", function ()
49 assert.same(test_frames.simple_empty, parse("\0\0"));
50 assert.same(test_frames.simple_data, parse("\0\5hello"));
51 assert.same(test_frames.simple_fin, parse("\128\0"));
52 end);
53 end);
55 end);