Macaulay2 » Documentation
Packages » Macaulay2Doc :: tests
next | previous | forward | backward | up | index | toc

tests -- locate a package's tests

Synopsis

Description

When an integer is not provided, this returns all the tests for the given package. The position of each element 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 = {0 => TestInput[../../../../../Macaulay2/packages/FirstPackage.m2:54:5-56:3]}

o1 : NumberedVerticalList

If the test number is also provided, then the corresponding TestInput object is returned.

i2 : t = tests(0, "FirstPackage")

o2 = TestInput[../../../../../Macaulay2/packages/FirstPackage.m2:54:5-56:3]

o2 : TestInput

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

i3 : locate t

o3 = ../../../../../Macaulay2/packages/FirstPackage.m2:54:5-56:3

o3 : FilePosition
i4 : code t

o4 = ../../../../../Macaulay2/packages/FirstPackage.m2:54:5-56:3: --source
     code:
     TEST ///
         assert ( firstFunction 2 == "D'oh!" )
     ///

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

i5 : code 0

o5 = ../../../../../Macaulay2/packages/FirstPackage.m2:54:5-56:3: --source
     code:
     TEST ///
         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.