next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: tests

tests -- locate a package's tests

Synopsis

Description

Returns a hash table containing the tests for the given package. Each key of this hash table is an integer, which would be passed as the first argument of check to run the test. Each value is a TestInput object. These are printed with the location of the file so that you may quickly jump to the source code of the test when using Emacs.

i1 : tests "FirstPackage"

o1 = HashTable{0 =>                                                                  }
                    /usr/share/Macaulay2/FirstPackage.m2:54:1-57:1:

o1 : HashTable
i2 : t = oo#0

o2 = 
     /usr/share/Macaulay2/FirstPackage.m2:54:1-57:1:

o2 : TestInput

The locate and code functions do the expected thing when given a TestInput object.

i3 : locate t

o3 = (/usr/share/Macaulay2/FirstPackage.m2, 54, 1, 57, 1, ,
     ------------------------------------------------------------------------
     )

o3 : Sequence
i4 : code t

o4 = --/usr/share/Macaulay2/FirstPackage.m2:57: location of test code

         assert ( firstFunction 2 == "D'oh!" )

Passing only the key of the desired test to code is supported as well.

i5 : code 0

o5 = --/usr/share/Macaulay2/FirstPackage.m2:57: location of test code

         assert ( firstFunction 2 == "D'oh!" )

You may also pass a TestInput object to edit to open the code in your favorite editor.

Ways to use tests :

For the programmer

The object tests is a method function.