diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index cd6ce85..b6f1ac0 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -1,15 +1,27 @@ # Installation - +[nightly]: https://github.com/arturo-lang/nightly/releases +[packager]: https://pkgr.art/ diff --git a/docs/LEARNING.md b/docs/LEARNING.md index b14434d..58888d8 100644 --- a/docs/LEARNING.md +++ b/docs/LEARNING.md @@ -1,13 +1,7 @@ # Learning - +[nutshell]: https://arturo-lang.io/master/documentation/in-a-nutshell/ +[rosetta-code]: https://rosettacode.org/wiki/Category:Arturo diff --git a/docs/RESOURCES.md b/docs/RESOURCES.md index 9811f04..04005f6 100644 --- a/docs/RESOURCES.md +++ b/docs/RESOURCES.md @@ -1,13 +1,11 @@ # Resources - +* [Official Documentation][official-docs] covers syntax, language features, and the standard library modules. +* [Arturo Discord][discord] is Arturo's official Discord server. +* [Rosetta Code][rosetta-code] has over 770+ Arturo code examples for many different tasks. +* [Packager][packager] is Arturo's official package registry. + +[official-docs]: https://arturo-lang.io/master/documentation/ +[discord]: https://discord.gg/YdVK2CB +[packager]: https://pkgr.art/ +[rosetta-code]: https://rosettacode.org/wiki/Category:Arturo diff --git a/docs/TESTS.md b/docs/TESTS.md index bec9502..9e076af 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -1,15 +1,250 @@ # Tests - + +`tests/test-.art` contains the test cases for the exercise. +These tests are organized into one or more test suites. +Each test suite is defined with the `suite` word and contains one or more test cases defined with the `test` word. +After the first test case, all test cases are initially skipped with the `skip` attribute. +Replace `test.skip` with `test`, removing the `skip` attribute, for the test case you want to unskip. + +Withn each test case, there will be a descriptive message which is reported when the test case is run. +There will also be one or more assertions comparing an expected value (on the left) to a value returned by your code (on the right). + +For example, the following code is a reduced test suite for the Leap exercise. + +```arturo +import {unitt}! +import {src/leap}! + +suite "Leap" [ + test "a year not divisible by 4 is a common year" [ + result: isLeap? 2015 + assert -> false = result + ] + + test.skip "a year divisible by 2 and not divisible by 4 is a common year" [ + result: isLeap? 1970 + assert -> false = result + ] + + test.skip "a year divisible by 4 and not divisible by 100 is a leap year" [ + result: isLeap? 1996 + assert -> true = result + ] +] +``` + +After both `unitt` and your Leap solution is imported, Arturo evaluates the "Leap" suite, encountering three tests. +Each test has a description and a message, but only the first one will be run. + +## Test Output + +Looking at the Leap exercise, let's see what the output of running the test suite is. +Let's use the following solution as a starting point. + +```arturo +isLeap?: function [year][ + panic "please implement the isLeap? function" +] +``` + +If we run the tests now, Arturo will panic while evaluating the first test. +Since it was unsuccessful in evaluating the first test, it will not continue to evaluate the other tests. +It will also report 0 assertions encountered due to this issue, looking something like this: + +```plaintext +===== tests\test-leap.art ===== + +Suite: Leap + + +══╡ Program Error ╞═════════════════════════════════════════════════