commit:     e36ce11c257fb088b5e889c9b68f31ced1eb849b
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Sat Nov 28 16:00:16 2020 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Sat Nov 28 16:16:38 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e36ce11c

dev-lua/luassert: migrate to lua eclass

Also adding and fixing tests.

Bug: https://bugs.gentoo.org/628758
Closes: https://bugs.gentoo.org/629658
Closes: https://bugs.gentoo.org/752936
Package-Manager: Portage-3.0.9, Repoman-3.0.2
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 ...uassert-1.8.0-disable-highlightcolor-test.patch | 57 ++++++++++++++++++++++
 dev-lua/luassert/luassert-1.8.0-r100.ebuild        | 55 +++++++++++++++++++++
 dev-lua/luassert/metadata.xml                      |  6 ++-
 profiles/package.mask                              |  1 +
 4 files changed, 118 insertions(+), 1 deletion(-)

diff --git 
a/dev-lua/luassert/files/luassert-1.8.0-disable-highlightcolor-test.patch 
b/dev-lua/luassert/files/luassert-1.8.0-disable-highlightcolor-test.patch
new file mode 100644
index 00000000000..fe3f7815a04
--- /dev/null
+++ b/dev-lua/luassert/files/luassert-1.8.0-disable-highlightcolor-test.patch
@@ -0,0 +1,57 @@
+--- a/spec/formatters_spec.lua
++++ b/spec/formatters_spec.lua
+@@ -102,18 +102,6 @@
+     assert.is.equal(expected, formatted)
+   end)
+ 
+-  it("Checks to see if TableErrorHighlightColor changes error color", 
function()
+-    local ok, colors = pcall(require, "term.colors")
+-    if not ok then pending("lua term.colors not available") end
+-
+-    assert:set_parameter("TableErrorHighlightColor", "red")
+-    local t = {1,2,3}
+-    local fmtargs = { {crumbs = {2}} }
+-    local formatted = assert:format({t, n = 1, fmtargs = fmtargs})[1]
+-    local expected = string.format("("..tostring(t)..") {\n  [1] = 1\n %s[2] 
= 2\n  [3] = 3 }", colors.red("*"))
+-    assert.is.equal(expected, formatted)
+-  end)
+-
+   it("Checks to see if self referencing tables can be formatted", function()
+     local t = {1,2}
+     t[3] = t
+--- a/spec/assertions_spec.lua
++++ b/spec/assertions_spec.lua
+@@ -472,17 +472,6 @@
+     assert.no_error_matches(t_ok, ".*")
+   end)
+ 
+-  it("Checks error_matches compares error strings with pattern", function()
+-    assert.error_matches(function() error() end, nil)
+-    assert.no_error_matches(function() end, nil)
+-    assert.does_error_match(function() error(123) end, "^%d+$")
+-    assert.error.matches(function() error("string") end, "^%w+$")
+-    assert.matches.error(function() error("string") end, "str", nil, true)
+-    assert.matches_error(function() error("123string") end, "^[^0-9]+", 4)
+-    assert.has_no_error.match(function() error("123string") end, "123", 4, 
true)
+-    assert.does_not.match_error(function() error("string") end, "^%w+$", nil, 
true)
+-  end)
+-
+   it("Checks error_matches does not compare error objects", function()
+     local func = function() end
+     assert.no_error_matches(function() error({ "table" }) end, "table")
+@@ -557,15 +546,6 @@
+     assert.is_same({}, {assert.has_no_match("%d+", "string", nil, true, 
"message")})
+   end)
+ 
+-  it("Checks assert.has_error returns thrown error on success", function()
+-    assert.is_same({"err message", "err message"}, 
{assert.has_error(function() error("err message") end, "err message")})
+-    assert.is_same({"err", "err"}, {assert.has_error(function() 
error(setmetatable({},{__tostring = function() return "err" end})) end, "err")})
+-    assert.is_same({{}, {}}, {assert.has_error(function() error({}) end, {})})
+-    assert.is_same({'0', 0}, {assert.has_error(function() error(0) end, 0)})
+-    assert.is_same({nil, nil}, {assert.has_error(function() error(nil) end, 
nil)})
+-    assert.is_same({nil, "string"}, {assert.has_no_error(function() end, 
"string")})
+-  end)
+-
+   it("Checks assert.error_matches returns captures of thrown error on 
success", function()
+     assert.is_same({"err", "message"}, {assert.error_matches(function() 
error("err message") end, "(err) (%w+)$")})
+     assert.is_same({"err"}, {assert.error_matches(function() 
error(setmetatable({},{__tostring = function() return "err" end})) end, "err", 
nil, true)})

diff --git a/dev-lua/luassert/luassert-1.8.0-r100.ebuild 
b/dev-lua/luassert/luassert-1.8.0-r100.ebuild
new file mode 100644
index 00000000000..4158856c1b1
--- /dev/null
+++ b/dev-lua/luassert/luassert-1.8.0-r100.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LUA_COMPAT=( lua5-{1..3} luajit )
+
+inherit lua toolchain-funcs
+
+DESCRIPTION="Assertion library for Lua"
+HOMEPAGE="http://olivinelabs.com/busted/";
+SRC_URI="https://github.com/Olivine-Labs/${PN}/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~x86"
+IUSE="test"
+REQUIRED_USE="${LUA_REQUIRED_USE}"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       >=dev-lua/say-1.3_p1-r100
+       ${LUA_DEPS}
+"
+
+BDEPEND="
+       virtual/pkgconfig
+       test? (
+               >=dev-lua/busted-2.0.0-r100
+               ${RDEPEND}
+       )
+"
+
+DEPEND="${RDEPEND}"
+
+PATCHES=( "${FILESDIR}/${PN}-1.8.0-disable-highlightcolor-test.patch" )
+
+lua_src_test() {
+       busted --lua=${ELUA} || die
+}
+
+src_test() {
+       lua_foreach_impl lua_src_test
+}
+
+lua_src_install() {
+       insinto $(lua_get_lmod_dir)/luassert
+       doins -r src/.
+
+       einstalldocs
+}
+
+src_install() {
+       lua_foreach_impl lua_src_install
+}

diff --git a/dev-lua/luassert/metadata.xml b/dev-lua/luassert/metadata.xml
index 0c230917f9a..7a9d0e9a430 100644
--- a/dev-lua/luassert/metadata.xml
+++ b/dev-lua/luassert/metadata.xml
@@ -5,7 +5,11 @@
                <email>willi...@gentoo.org</email>
                <name>William Hubbs</name>
        </maintainer>
-       <longdescription lang="en">
+       <maintainer type="person">
+               <email>conik...@gentoo.org</email>
+               <name>Conrad Kostecki</name>
+       </maintainer>
+       <longdescription>
                Adds a framework that allows registering new assertions
                without compromising builtin assertion functionality.
        </longdescription>

diff --git a/profiles/package.mask b/profiles/package.mask
index 71d18cdfa40..864c47017f9 100644
--- a/profiles/package.mask
+++ b/profiles/package.mask
@@ -510,6 +510,7 @@ dev-lua/luacrypto
 >=dev-lua/luafilesystem-1.8.0-r100
 >=dev-lua/luasec-0.9-r100
 >=dev-lua/luasocket-3.0_rc1_p20200328-r100
+>=dev-lua/luassert-1.8.0-r100
 >=dev-lua/luasystem-0.2.1_p0-r100
 >=dev-lua/lutok-0.4-r10
 >=dev-lua/luv-1.32.0.0-r100

Reply via email to