[latex3-commits] [git/LaTeX3-latex3-l3build] experimental: Added unit tests for the text module. (4727741)

Paulo Roberto Massa Cereda cereda.paulo at gmail.com
Tue Aug 6 17:30:49 CEST 2019


Repository : https://github.com/latex3/l3build
On branch  : experimental
Link       : https://github.com/latex3/l3build/commit/47277416a5b71f9ec2fad2dafc374da04ed19d18

>---------------------------------------------------------------

commit 47277416a5b71f9ec2fad2dafc374da04ed19d18
Author: Paulo Roberto Massa Cereda <cereda.paulo at gmail.com>
Date:   Tue Aug 6 12:30:49 2019 -0300

    Added unit tests for the text module.


>---------------------------------------------------------------

47277416a5b71f9ec2fad2dafc374da04ed19d18
 unittests/Makefile              |  8 +++++
 unittests/test_l3build-text.lua | 71 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+)

diff --git a/unittests/Makefile b/unittests/Makefile
new file mode 100644
index 0000000..53b55db
--- /dev/null
+++ b/unittests/Makefile
@@ -0,0 +1,8 @@
+all: arguments text
+
+arguments:
+	texlua test_l3build-arguments.lua
+
+text:
+	texlua test_l3build-text.lua
+
diff --git a/unittests/test_l3build-text.lua b/unittests/test_l3build-text.lua
new file mode 100644
index 0000000..97d6dee
--- /dev/null
+++ b/unittests/test_l3build-text.lua
@@ -0,0 +1,71 @@
+--[[
+
+File test_l3build-text.lua Copyright (C) 2019 The LaTeX3 Project
+
+It may be distributed and/or modified under the conditions of the
+LaTeX Project Public License (LPPL), either version 1.3c of this
+license or (at your option) any later version.  The latest version
+of this license is in the file
+
+   http://www.latex-project.org/lppl.txt
+
+This file is part of the "l3build bundle" (The Work in LPPL)
+and all files in that bundle must be distributed together.
+
+-----------------------------------------------------------------------
+
+The development version of the bundle can be found at
+
+   https://github.com/latex3/l3build
+
+for those people who are interested.
+
+--]]
+
+--- Provides test unit cases for `l3build-text`.
+-- This test unit aims at checking the `l3build-text` module.
+-- @author The LaTeX3 team
+-- @license LaTeX Project Public License (LPPL 1.3c)
+-- @copyright 2019 The LaTeX3 Project
+-- @release 1.0
+
+-- load namespaces
+local lu = require('luaunit')
+
+-- set path to load modules
+-- from the top directory
+package.path = package.path .. ';../?.lua'
+local l3text = require('l3build-text')
+
+function testWrap()
+  local a = 'Hello, welcome to my terminal text. This might be a long, very long entry,' ..
+            ' but hopefully the wrap() function will break it into smaller chunks of text!' ..
+            ' Also with color support!'
+  local b = 'Hello, welcome to my terminal text. This might be a long, very long \n' ..
+            'entry, but hopefully the wrap() function will break it into smaller \n' ..
+            'chunks of text! Also with color support!'
+  lu.assertEquals(l3text.wrap(a, 70), b)
+end
+
+function testWrapPad()
+  local a = 'Hello, welcome to my terminal text. This might be a long, very long entry,' ..
+            ' but hopefully the wrap() function will break it into smaller chunks of text!' ..
+            ' Also with color support!'
+  local b = 'Hello, welcome to my terminal text. This might be a long, very long \n' ..
+            '   entry, but hopefully the wrap() function will break it into smaller \n' ..
+            '   chunks of text! Also with color support!'
+  lu.assertEquals(l3text.wrap(a, 70, 3, false), b)
+end
+
+function testWrapPadWithFirstLine()
+  local a = 'Hello, welcome to my terminal text. This might be a long, very long entry,' ..
+            ' but hopefully the wrap() function will break it into smaller chunks of text!' ..
+            ' Also with color support!'
+  local b = '   Hello, welcome to my terminal text. This might be a long, very long \n' ..
+            '   entry, but hopefully the wrap() function will break it into smaller \n' ..
+            '   chunks of text! Also with color support!'
+  lu.assertEquals(l3text.wrap(a, 70, 3, true), b)
+end
+
+-- run tests
+os.exit(lu.LuaUnit.run())
\ No newline at end of file





More information about the latex3-commits mailing list