Software /
code /
prosody
Comparison
spec/net_websocket_frames_spec.lua @ 11165:eae8046d51fc 0.11
net.websocket.frames: Add test for empty frame with MASK and key set
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 15 Oct 2020 14:01:22 +0100 |
parent | 11164:4e5a2af9dd19 |
child | 11166:51e5149ed0ad |
comparison
equal
deleted
inserted
replaced
11164:4e5a2af9dd19 | 11165:eae8046d51fc |
---|---|
41 ["MASK"] = true; | 41 ["MASK"] = true; |
42 ["RSV1"] = false; | 42 ["RSV1"] = false; |
43 ["RSV2"] = false; | 43 ["RSV2"] = false; |
44 ["RSV3"] = false; | 44 ["RSV3"] = false; |
45 }; | 45 }; |
46 empty_with_mask = { | |
47 ["opcode"] = 0; | |
48 ["key"] = " \0 \0"; | |
49 ["FIN"] = true; | |
50 ["MASK"] = true; | |
51 ["RSV1"] = false; | |
52 ["RSV2"] = false; | |
53 ["RSV3"] = false; | |
54 }; | |
46 } | 55 } |
47 | 56 |
48 describe("build", function () | 57 describe("build", function () |
49 local build = nwf.build; | 58 local build = nwf.build; |
50 it("works", function () | 59 it("works", function () |
51 assert.equal("\0\0", build(test_frames.simple_empty)); | 60 assert.equal("\0\0", build(test_frames.simple_empty)); |
52 assert.equal("\0\5hello", build(test_frames.simple_data)); | 61 assert.equal("\0\5hello", build(test_frames.simple_data)); |
53 assert.equal("\128\0", build(test_frames.simple_fin)); | 62 assert.equal("\128\0", build(test_frames.simple_fin)); |
54 assert.equal("\128\133 \0 \0HeLlO", build(test_frames.with_mask)) | 63 assert.equal("\128\133 \0 \0HeLlO", build(test_frames.with_mask)) |
64 assert.equal("\128\128 \0 \0", build(test_frames.empty_with_mask)) | |
55 end); | 65 end); |
56 end); | 66 end); |
57 | 67 |
58 describe("parse", function () | 68 describe("parse", function () |
59 local parse = nwf.parse; | 69 local parse = nwf.parse; |