Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
347 stars 231 forks source link

Quickly find location of package tests #1764

Closed d-torrance closed 2 years ago

d-torrance commented 3 years ago

I removed it knowing that errors, we still get the test location in the error with Verbose => true:

Yes, I'm aware of that. But we may not get that far, as I explained above.

You always know the test number before the failure occurs, why not add a helper function to tell you the test location given the test number so you can debug it? Then you can add a method to edit, or perhaps a new function editTest or viewTest so you can automatically open an editor to that location.

Originally posted by @mahrud in https://github.com/Macaulay2/M2/issues/1762#issuecomment-752702567

d-torrance commented 3 years ago

We can kind of do this now, but it's ugly:

i4 : (Core#"test inputs"#0)_{0,1}

o4 = {/usr/share/doc/Macaulay2/Core/tests/0-homog.m2, 1}

Plus it would be nice if we knew more information than just the line number, like the output of locate. This could be used by edit, code, etc.

And perhaps, if something like code_0 Core worked to read the file and get the code of a test, then we could dispense with storing a bunch of strings containing test code in memory and just grab them as we need them.

mahrud commented 3 years ago

Could have a function like examples, perhaps tests, that returns something like that.