From aa5181b199a5f66178c134ab5e259b87501c4739 Mon Sep 17 00:00:00 2001 From: Paul Cuthbertson Date: Sun, 3 Apr 2016 19:34:02 +0100 Subject: [PATCH] Adds tests for PR#28. --- test/lua/lib-string.lua | 4 +++- test/lua/operators.lua | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/lua/lib-string.lua b/test/lua/lib-string.lua index e99d94e..964ecd8 100644 --- a/test/lua/lib-string.lua +++ b/test/lua/lib-string.lua @@ -472,7 +472,6 @@ end - -- gsub a = '<%?xml version="1.0" encoding="UTF%-8"%?>' @@ -514,6 +513,9 @@ assertTrue (d == ':X:X:X:X:X:', 'string.gsub() should replace the matched part o c = string.gsub (';a;', 'a*', 'ITEM') assertTrue (c == 'ITEM;ITEMITEM;ITEM', 'string.gsub() should replace the matched part of the string[2]') +a = 'abc\\def' +b = string.gsub(a, '\\', '\\\\') +assertEqual (b, 'abc\\\\def', 'Allow backslashes in regexes') diff --git a/test/lua/operators.lua b/test/lua/operators.lua index 87d2fd5..3607c3c 100644 --- a/test/lua/operators.lua +++ b/test/lua/operators.lua @@ -233,4 +233,5 @@ for name, test in pairs(tests) do end +assertTrue('abc' < 'def', 'Strings should be comparable')