Content deleted Content added
→Internationalizing this module: new section |
m Replaced deprecated <source> tags with <syntaxhighlight> (via WP:JWB) |
||
(One intermediate revision by one other user not shown) | |||
Line 15:
::: Great. But perhaps we should name it <code>assertStringContains</code> in case we later implement a method that checks if a table contains a given table key? And yes, we should have tests for the assertions as well. I'm not really sure how to write good tests for a testing module, but I started experimenting on [[Module:ScribuntoUnit/testcases]]. – ''[[User:Danmichaelo|Danmichaelo]] ([[User talk:Danmichaelo|talk]])'' 08:42, 3 January 2014 (UTC)
:::: So renamed. Sounds like a good reason to me. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 14:05, 3 January 2014 (UTC)
::: Automated tests are needed, but I think there is also a need for a visual presentation of how the module works in practise. I have created such a page: [[Module:ScribuntoUnit/showcase]] (run on the talk page). If I did not invoke something wrong, it seems that
:::: Agree, the showcase page is a good idea. Seems like the output is not so consistent between the different methods; on failure, some methods include "actual" and "expected", while others do not. If "actual" and "expected" are included, "message" is not shown. This leads me to thinking that we might be better of just replacing the two columns by a single column. I updated [[Module:ScribuntoUnit/sandbox]] and [[Module talk:ScribuntoUnit/showcase]]. What do you think? – ''[[User:Danmichaelo|Danmichaelo]] ([[User talk:Danmichaelo|talk]])'' 18:21, 5 January 2014 (UTC)
::: I made small tweaks to the sandbox code. I like it now. --[[User:Derbeth|Derbeth]] [[User talk:Derbeth|<sup>talk</sup>]] 10:31, 6 January 2014 (UTC)
Line 30:
: Hm, how does it fail? I tried using mw.title at [[Module_talk:ScribuntoUnit/showcase]], and it seems to work, but I'm not familiar with it. – ''[[User:Danmichaelo|Danmichaelo]] ([[User talk:Danmichaelo|talk]])'' 18:47, 5 January 2014 (UTC)
:: You used the mw.title library, rather than a title object. To get a title object you need to use code like <code>mw.title.new('Wikipedia:Sandbox')</code>. I tried doing just that in the showcase module, and the whole script fails with a "not enough memory" error. The problem is that some of the title object fields are self-references. For example:
<
local sandbox = mw.title.new('Wikipedia:Sandbox') -- title object for [[Wikipedia:Sandbox]]
sandbox.basePageTitle -- Also the title object for [[Wikipedia:Sandbox]]
sandbox.basePageTitle.basePageTitle -- Again, the same title object.
</syntaxhighlight>
:: So if you try and iterate recursively through any given title object, while respecting metatables, you will just keep on going forever. Scribunto then dies when it runs into the memory limit. This problem has been resolved somehow in mw.logObject, but I haven't looked deeply enough at the code to know exactly what was done. — '''''[[User:Mr. Stradivarius|<span style="color: #194D00; font-family: Palatino, Times, serif">Mr. Stradivarius</span>]]''''' <sup>[[User talk:Mr. Stradivarius|♪ talk ♪]]</sup> 11:06, 6 January 2014 (UTC)
|