Replies: 9 comments 29 replies
-
I'm new to GitHub Discussions so will do my best to get replies here right :) Ideally one would branch into separate threads, but I don't see how that's done ... the equivalent of 'XXXX [Was: YYYY]' is not obvious to me.
I know you are aware, but for the record here: the main aim of
Now, I know it's not perfect: I learned a lot of Lua writing the early versions of |
Beta Was this translation helpful? Give feedback.
-
I moved the targets to using a (documented) table rather than a simple hard-coded list in a
True. At the moment, I've not worked out how to give a nice interface here. Ideas very welcome.
I see the point: should be easy enough to set up. That said, no one has ever asked for this ... |
Beta Was this translation helpful? Give feedback.
-
The original code was all written by me and was self-consistent if not following a 'typical' Lua style. I agree that as the tool has grown there have been more variations in style. I'd be happy to go though some cosmetic refactoring, agreeing a rule, applying it to the current code, documenting it. Does anyone know of any Lua linters? |
Beta Was this translation helpful? Give feedback.
-
A bit of background before moving to replying. The original design had a single file which was accessed by using We did deprecate the
We moved some way toward that by documenting any of them ;) I agree this can and should be tightened up.
I'm not completely clear what you mean!
You mean
Here I'm a bit wary, but would welcome input from proper Lua programmers (@zauguin, @cereda for example). As I said earlier, the file split is mainly for convenient. To me, everything is in one 'module': it's not like |
Beta Was this translation helpful? Give feedback.
-
You might guess that I, at least, have basically no idea about how to do unit testing for Lua :) Without |
Beta Was this translation helpful? Give feedback.
-
Am 21.01.21 um 14:30 schrieb Joseph Wright:
We did deprecate the |texlua build.lua| form but haven't totally dropped
it: perhaps that is a place to start?
just one comment on this one here: I would not drop that support.
currently l3build works on *any* TeX installation that has a luatex
engine around (or a lua on the system). l3build as a tool is great, but
it is restricted to distributions based on TL or miktex and that's it.
So dropping that deprecated way means you drop support for anything not
having l3build
|
Beta Was this translation helpful? Give feedback.
-
On Thu, 21 Jan 2021 at 22:56, LAURENS Jérôme ***@***.***> wrote:
I use LuaUnit with some ideas of mine to embed the tests in the source
code. Very powerful and versatile. Consider for example
next foo.lua:
function Add( a, b ) return a + b end
--[[ LU
function TestAdd() LU.assertEquals( Add( 2, 2 ), 4 ) return
--]]
My script will turn foo.lua into foo.test.lua and make the test. If Add(
2, 2 ) would return anything but 4, it would be reported.
Currently we have no dependencies on Lua libraries that are not included in
luatex as shipped in texlive and miktex, I think that's a feature that we
should preserve, so I don't think a library like LuaUnit is an option,
really.
|
Beta Was this translation helpful? Give feedback.
-
On Fri, 22 Jan 2021 at 16:55, LAURENS Jérôme ***@***.***> wrote:
@josephwright <https://github.com/josephwright>
LuaUnit.lua is exactly what you are asking for.
You just need to have a copy in the repository and that's it,
and a lua executable of course.
Whether tests are launched by texlua or lua does not matter.
Well yes and no. Especially when Lua has big changes such as when the
integer type was added, what matters is that the code matches texlua in the
targeted version of texlive. Whether the code works with the version of Lua
you have locally (or even if you have a Lua install at all) is not
important, so while it doesn't do any harm if people try it with a system
Lua, the test requirement has to be that the code is correct for texlua.
David
|
Beta Was this translation helpful? Give feedback.
-
@jlaurens You can get a version string via |
Beta Was this translation helpful? Give feedback.
-
Some time ago,
l3build
was made available to the public, and according to questions on TXS, package writers do use it. I bet that people will use it more and more for 2 reasons: the \Huge testing facilities and the necessary transition to LaTeX3.Actually, there is at least one minor bug and some potential problems but none of them impact the usage of
l3build
as it was designed for: buildinglatex
. However, their impact on 3rd party code may be real, causing weird behaviors difficult to debug. All this is not easy to evaluate because the whole source code is still very intricate.There are at least 4 points where
l3build
can be improved or enhanced:User interface
Here are the limited limitations I can think of
l3build
allows custom targets, but its internals are publicly exposed for that, some dedicated function would help.--quiet [true]
,--quiet false
,--debug [on]
,--debug off
...All this will not break existing
l3build
usage.code style
We can see how different pieces of code reflect the style of their contributors.
Unfortunately, there is some lack of consistency that makes the code difficult to read and understand,
therefore difficult to maintain.
Some basic rules would help a lot on that respect. Fortunately, these are just cosmetic changes.
code design
When run
l3build
basicallybuild.lua
build-...lua
During these steps, quite any object is kept in the global environment which is not recommended
for various very good reasons. The only variable and functions publicly available to
build*.lua
should beexactly the ones documented in
l3build.dtx
, no less and no more (except intentionally hidden private features of course).The status of all global variables is quite difficult to guess. We understand that some of them are readonly because the code seems to make the implicit assumption that they won't ever be modified. But clearly stating the readonly status and preventing modifications would help a lot. For example, one of the modules should be dedicated to OS related stuff and would be readonly.
Code separation is also a good practice. Splitting the code into different modules is definitely the way to go. The next step is to minimize module dependencies, in particular, cross dependencies should really be avoided. For that, some functions should rely more on formal arguments than global variables. Moreover require/provide techniques would help to manage module dependencies.
Unit testing
One of the main problems of unit testing is code coverage: any reachable piece of code should be tested. Testing can be made directly on
l3build
by analyzing the results of a command run in some source directory. Many different source examples are required to cover the different situations. This is provided. On the other hand, one can use unit testing with the help of a standard Lua library. This is a flexible and complementary approach we should definitely tend to adopt.Is it possible to make all these changes without breaking anything? Definitely yes, but this is the subject of a forthcoming discussion.
In the meantime comments and suggestions are welcome.
Beta Was this translation helpful? Give feedback.
All reactions