Software /
code /
prosody
Comparison
tests/test_utf8.lua @ 7961:ff556d010225
tests: Trim trailing whitespace
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 06 Mar 2017 16:01:27 +0100 |
parent | 7515:9e48299799d8 |
comparison
equal
deleted
inserted
replaced
7960:9a938b785bc5 | 7961:ff556d010225 |
---|---|
2 package.path = "../?.lua"; | 2 package.path = "../?.lua"; |
3 | 3 |
4 function valid() | 4 function valid() |
5 local encodings = require "util.encodings"; | 5 local encodings = require "util.encodings"; |
6 local utf8 = assert(encodings.utf8, "no encodings.utf8 module"); | 6 local utf8 = assert(encodings.utf8, "no encodings.utf8 module"); |
7 | 7 |
8 for line in io.lines("utf8_sequences.txt") do | 8 for line in io.lines("utf8_sequences.txt") do |
9 local data = line:match(":%s*([^#]+)"):gsub("%s+", ""):gsub("..", function (c) return string.char(tonumber(c, 16)); end) | 9 local data = line:match(":%s*([^#]+)"):gsub("%s+", ""):gsub("..", function (c) return string.char(tonumber(c, 16)); end) |
10 local expect = line:match("(%S+):"); | 10 local expect = line:match("(%S+):"); |
11 if expect ~= "pass" and expect ~= "fail" then | 11 if expect ~= "pass" and expect ~= "fail" then |
12 error("unknown expectation: "..line:match("^[^:]+")); | 12 error("unknown expectation: "..line:match("^[^:]+")); |