Unit testing: Difference between revisions

m
→‎{{header|Wren}}: Fixed an internal link.
m (→‎{{header|Wren}}: Fixed an internal link.)
 
(4 intermediate revisions by 2 users not shown)
Line 6:
 
Clearly state whether this support is internal, or external to the interpreter or compiler used.
 
=={{header|FreeBASIC}}==
'''fbcunit''' - FreeBASIC Compiler Unit Testing Component<br>
Copyright (C) 2017-2020 Jeffery R. Marshall (coder[at]execulink[dot]com)
 
Unit testing component for fbc compiler. Provides macros and common code for unit testing fbc compiled sources.
 
See https://github.com/jayrm/fbcunit.
 
=={{header|Go}}==
Line 13 ⟶ 21:
 
For a simple example of the testing process, check out the [[Test_a_function#Go]] task.
 
=={{Header|Insitux}}==
 
Alongside assertions and mocking available in pure Insitux (see [https://www.rosettacode.org/wiki/Test_a_function#Insitux Test a function]), the Node.js REPL has the ability to generate a code coverage report of unvisited lines and columns, useful for writing thorough unit tests. Here is a basic demonstration:
 
<syntaxhighlight lang="insitux" line>
(function subject x y z
(return-unless (num? x) x)
(return-unless (num? y) y)
(if x y z))
 
 
(assert (= (subject :a 2 3) :a))
(assert (= (subject 1 :b 3) :b))
(assert (= (subject 1 2 3) 2))
</syntaxhighlight>
 
{{out}}
 
Invoked from the terminal with <code>npx ix . -unv</code>.
 
<pre>
unvisited.txt generated: 1 unvisited (97% coverage)
true
</pre>
 
<code>unvisited.txt</code>:
 
<pre>
entry.ix 4 11
</pre>
 
We're being told here that line 4, column 11 has an expression which was not visited at runtime. Through investigation we see that it's impossible for <code>z</code> to be returned, as <code>x</code> must always be a number - an inherently truthy value.
 
=={{header|Java}}==
Line 257 ⟶ 298:
As a language chiefly intended for embedding, Wren's standard library is quite small and there is no built-in support for unit testing as such.
However, there is an external module called [[https://rosettacode.org/wiki/Category:Wren-test |Wren-test]] which can be used for this purpose and whose documentation should be consulted for the features it contains.
 
=={{header|zkl}}==
9,486

edits