Software / code / prosody
Comparison
tests/test_utf8.lua @ 7516:f74ff35a4b03
Merge 0.10->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 23 Jul 2016 18:58:58 +0200 |
| parent | 7515:9e48299799d8 |
| child | 7961:ff556d010225 |
comparison
equal
deleted
inserted
replaced
| 7510:8a0a50e8ef2d | 7516:f74ff35a4b03 |
|---|---|
| 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("^[^:]+")); |
| 13 end | 13 end |
| 14 local prefix, style = " ", valid_style; | |
| 15 local valid = utf8.valid(data); | 14 local valid = utf8.valid(data); |
| 16 assert_equal(valid, utf8.valid(data.." ")); | 15 assert_equal(valid, utf8.valid(data.." ")); |
| 17 assert_equal(valid, expect == "pass", line); | 16 assert_equal(valid, expect == "pass", line); |
| 18 end | 17 end |
| 19 end | 18 end |