aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/036_regexp_character_classes_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-01-03 02:09:18 +0100
committerJustin M. Keyes <justinkz@gmail.com>2024-01-03 02:09:29 +0100
commit04f2f864e270e772c6326cefdf24947f0130e492 (patch)
tree46f83f909b888a66c741032ab955afc6eab84292 /test/functional/legacy/036_regexp_character_classes_spec.lua
parent59d117ec99b6037cb9fad5bbfb6d0b18f5012927 (diff)
downloadrneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.gz
rneovim-04f2f864e270e772c6326cefdf24947f0130e492.tar.bz2
rneovim-04f2f864e270e772c6326cefdf24947f0130e492.zip
refactor: format test/*
Diffstat (limited to 'test/functional/legacy/036_regexp_character_classes_spec.lua')
-rw-r--r--test/functional/legacy/036_regexp_character_classes_spec.lua83
1 files changed, 59 insertions, 24 deletions
diff --git a/test/functional/legacy/036_regexp_character_classes_spec.lua b/test/functional/legacy/036_regexp_character_classes_spec.lua
index 6f66efcb67..ed35b2b245 100644
--- a/test/functional/legacy/036_regexp_character_classes_spec.lua
+++ b/test/functional/legacy/036_regexp_character_classes_spec.lua
@@ -5,16 +5,16 @@ local clear, command, expect = helpers.clear, helpers.command, helpers.expect
local source, write_file = helpers.source, helpers.write_file
local function sixlines(text)
- local result = ''
- for _ = 1, 6 do
- result = result .. text .. '\n'
- end
- return result
+ local result = ''
+ for _ = 1, 6 do
+ result = result .. text .. '\n'
+ end
+ return result
end
local function diff(text, nodedent)
local fname = helpers.tmpname()
- command('w! '..fname)
+ command('w! ' .. fname)
helpers.poke_eventloop()
local data = io.open(fname):read('*all')
if nodedent then
@@ -40,7 +40,16 @@ describe('character classes in regexp', function()
-- The original test32.in file was not in utf-8 encoding and did also
-- contain some control characters. We use lua escape sequences to write
-- them to the test file.
- local line = ctrl1..punct1..digits..punct2..upper..punct3..lower..punct4..ctrl2..iso_text
+ local line = ctrl1
+ .. punct1
+ .. digits
+ .. punct2
+ .. upper
+ .. punct3
+ .. lower
+ .. punct4
+ .. ctrl2
+ .. iso_text
write_file('test36.in', sixlines(line))
end)
before_each(function()
@@ -59,8 +68,9 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-9]//g
5 s/\%#=1[0-9]//g
6 s/\%#=2[0-9]//g]])
- diff(sixlines(ctrl1..punct1..punct2..upper..punct3..lower..punct4..
- ctrl2..iso_text))
+ diff(
+ sixlines(ctrl1 .. punct1 .. punct2 .. upper .. punct3 .. lower .. punct4 .. ctrl2 .. iso_text)
+ )
end)
it('is working', function()
source([[
@@ -86,8 +96,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-7]//g
5 s/\%#=1[0-7]//g
6 s/\%#=2[0-7]//g]])
- diff(sixlines(ctrl1..punct1..'89'..punct2..upper..punct3..lower..punct4..ctrl2..
- iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. '89' .. punct2 .. upper .. punct3 .. lower .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -113,7 +126,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-9A-Fa-f]//g
5 s/\%#=1[0-9A-Fa-f]//g
6 s/\%#=2[0-9A-Fa-f]//g]])
- diff(sixlines(ctrl1..punct1..punct2..'GHIXYZ'..punct3..'ghiwxyz'..punct4..ctrl2..iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. punct2 .. 'GHIXYZ' .. punct3 .. 'ghiwxyz' .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -139,7 +156,7 @@ describe('character classes in regexp', function()
4 s/\%#=0[0-9A-Za-z_]//g
5 s/\%#=1[0-9A-Za-z_]//g
6 s/\%#=2[0-9A-Za-z_]//g]])
- diff(sixlines(ctrl1..punct1..punct2..'[\\]^`'..punct4..ctrl2..iso_text))
+ diff(sixlines(ctrl1 .. punct1 .. punct2 .. '[\\]^`' .. punct4 .. ctrl2 .. iso_text))
end)
it('is working', function()
source([[
@@ -165,8 +182,7 @@ describe('character classes in regexp', function()
4 s/\%#=0[A-Za-z_]//g
5 s/\%#=1[A-Za-z_]//g
6 s/\%#=2[A-Za-z_]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..'[\\]^`'..punct4..ctrl2..
- iso_text))
+ diff(sixlines(ctrl1 .. punct1 .. digits .. punct2 .. '[\\]^`' .. punct4 .. ctrl2 .. iso_text))
end)
it('is working', function()
source([[
@@ -192,7 +208,7 @@ describe('character classes in regexp', function()
4 s/\%#=0[A-Za-z]//g
5 s/\%#=1[A-Za-z]//g
6 s/\%#=2[A-Za-z]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..punct3..punct4..ctrl2..iso_text))
+ diff(sixlines(ctrl1 .. punct1 .. digits .. punct2 .. punct3 .. punct4 .. ctrl2 .. iso_text))
end)
it('is working', function()
source([[
@@ -218,8 +234,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[a-z]//g
5 s/\%#=1[a-z]//g
6 s/\%#=2[a-z]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..upper..punct3..punct4..
- ctrl2..iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. digits .. punct2 .. upper .. punct3 .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -245,8 +264,11 @@ describe('character classes in regexp', function()
4 s/\%#=0[A-Z]//g
5 s/\%#=1[A-Z]//g
6 s/\%#=2[A-Z]//g]])
- diff(sixlines(ctrl1..punct1..digits..punct2..punct3..lower..punct4..
- ctrl2..iso_text))
+ diff(
+ sixlines(
+ ctrl1 .. punct1 .. digits .. punct2 .. punct3 .. lower .. punct4 .. ctrl2 .. iso_text
+ )
+ )
end)
it('is working', function()
source([[
@@ -272,8 +294,19 @@ describe('character classes in regexp', function()
4 s/\%#=0\%4l^\t...//g
5 s/\%#=1\%5l^\t...//g
6 s/\%#=2\%6l^\t...//g]])
- diff(sixlines(string.sub(punct1, 1)..digits..punct2..upper..punct3..
- lower..punct4..ctrl2..iso_text))
+ diff(
+ sixlines(
+ string.sub(punct1, 1)
+ .. digits
+ .. punct2
+ .. upper
+ .. punct3
+ .. lower
+ .. punct4
+ .. ctrl2
+ .. iso_text
+ )
+ )
end)
it('does not convert character class ranges to an incorrect class', function()
source([[
@@ -284,7 +317,9 @@ describe('character classes in regexp', function()
5 s/\%#=1[^0-z]//g
6 s/\%#=2[^0-z]//g
]])
- diff(string.rep(ctrl1..punct1..punct4..ctrl2..iso_text..'\n', 3)
- ..string.rep(digits..punct2..upper..punct3..lower..'\n', 3))
+ diff(
+ string.rep(ctrl1 .. punct1 .. punct4 .. ctrl2 .. iso_text .. '\n', 3)
+ .. string.rep(digits .. punct2 .. upper .. punct3 .. lower .. '\n', 3)
+ )
end)
end)