Minor issue with "setUp() and tearDown()" wiki example
treylav opened this issue · comments
Dmitry Lavrentev commented
Hello.
There is a minor error on page the wiki page setUp() and tearDown(). The following code will not compile:
// Create TestCase
test_example = new TestCase(function() {
// The _number variable is defined in the setUp() function
self.assertEqual(_number, 24);
}, "test_example");
// Define setUp() function
test_example.setUp(function() {
// Here we're defining a variable to use in our test
_number = 24;
});
// Define tearDown() function
test_example.tearDown(function() {
// We can call our _number variable in the tearDown() too
show_debug_message("Your number is: " + string(_number));
});
The error lies in the incorrect argument passing, apparently, the format has changed in one of the versions. The correct code would be something like:
// Create TestCase
test_example = new TestCase("test_example", function() {
// The _number variable is defined in the setUp() function
self.assertEqual(_number, 24);
});
Due to the odd logic of GitHub, I cannot make a pull request to suggest change for the wiki, so I create an issue.
Thanks in advance.
Brent Frymire commented
Thank you for the issue, good catch! I have made the change on the wiki.