Skip to content

Commit 8dd3ca5

Browse files
committed
utf8data test
1 parent d0cc7da commit 8dd3ca5

File tree

5 files changed

+25
-3
lines changed

5 files changed

+25
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ utf8.raw.gsub(str, "ло+", "보라")
3636

3737
It also provides all functions from Lua 5.3 UTF-8 [module](https://www.lua.org/manual/5.3/manual.html#6.5) except `utf8.len (s [, i [, j]])`. If you need to validate your strings use `utf8.validate(str, byte_pos)` or iterate over with `utf8.validator`.
3838

39+
Please note that library assumes regexes are valid UTF-8 strings, if you need to manipulate individual bytes use vanilla functions under `utf8.raw`.
40+
41+
3942
#### Installation:
4043

4144
Download repository to your project folder. (no rockspecs yet)

test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ for test in \
1212
test/context_runtime.lua \
1313
test/test.lua \
1414
test/test_compat.lua \
15-
test/test_pm.lua
15+
test/test_pm.lua \
16+
test/test_utf8data.lua
1617
do
1718
$lua53 $test
1819
$lua51 $test

test/charclass_compiletime.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local utf8 = require "init"
22
utf8.config = {
3-
debug = nil, --utf8:require("util").debug
3+
debug = nil,
4+
-- debug = utf8:require("util").debug,
45
}
56
utf8:init()
67

test/test.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
local utf8 = require('init')
22
utf8.config = {
3-
debug = nil, --utf8:require("util").debug
3+
debug = nil,
4+
-- debug = utf8:require("util").debug,
45
}
56
utf8:init()
7+
68
for k,v in pairs(utf8) do
79
string[k] = v
810
end

test/test_utf8data.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
local utf8uclc = require('init')
2+
utf8uclc.config = {
3+
debug = nil,
4+
-- debug = utf8:require("util").debug,
5+
conversion = {
6+
uc_lc = setmetatable({}, {__index = function(self, idx) return "l" end}),
7+
lc_uc = setmetatable({}, {__index = function(self, idx) return "u" end}),
8+
}
9+
}
10+
utf8uclc:init()
11+
12+
local assert_equals = require 'test.util'.assert_equals
13+
14+
assert_equals(utf8uclc.lower("фыва"), "llll")
15+
assert_equals(utf8uclc.upper("фыва"), "uuuu")

0 commit comments

Comments
 (0)