Shinmera / parachute

An extensible and cross-compatible testing framework.
https://shinmera.github.io/parachute
zlib License
94 stars 9 forks source link

*PRINT-CASE* is not respected when printing plain report #21

Closed phoe closed 1 year ago

phoe commented 4 years ago
PARACHUTE> (define-test numbers
  (of-type integer 5)
  (true (numberp 2/3))
  (false (numberp :keyword))
  (is-values (values 0 "1")
    (= 0)
    (equal "1")))
NUMBERS

PARACHUTE> (let ((*print-case* :downcase))
             (test 'numbers))
        ? PARACHUTE::numbers
  0.000 ✔   (of-type integer 5)
  0.000 ✔   (true (numberp 2/3))
  0.000 ✔   (false (numberp :keyword))
  0.000 ✔   (is-values (values 0 "1") (= 0) (equal "1"))
  0.042 ✔ PARACHUTE::numbers

;; Summary:
Passed:     4
Failed:     0
Skipped:    0
#<PLAIN 5, PASSED results>

PARACHUTE::numbers is not the best way of respecting *PRINT-CASE*. Possibly this variable needs to be accounted for in format-result methods, in and after here:

https://github.com/Shinmera/parachute/blob/a9fdae87abf3c5070d77a68c5a7c967da686f556/result.lisp#L244-L247

Shinmera commented 4 years ago

I don't understand, symbol-name is not subject to *print-case*.

phoe commented 4 years ago

But package name is.

* (dolist (c '(:downcase :upcase :capitalize)) (let ((*print-case* c)) (print 'sb-ext:%break)))
sb-int:%break 
SB-INT:%BREAK 
Sb-Int:%Break 
Shinmera commented 4 years ago

Huh? No it's not. That test case doesn't really say anything. Try this instead:

(dolist (c '(:downcase :upcase :capitalize)) (let ((*print-case* c)) (print (package-name (symbol-package 'foo)))))

The package is still always uppercase, just like the symbol name.

phoe commented 4 years ago

package-name is a string, so obviously it is not affected by *print-case*. However, the plain report prints test names in a symbol-like way, with the package name and a quad-colon qualifier followed by the test name. For some reason, the test name is affected by the current print case, while the package name is not; that is inconsistent with printing actual symbol names, where the package name is affected by the current print case.

Shinmera commented 1 year ago

Okey, so, the printing of test results is handled in report.lisp:274. The reason it doesn't use symbol-name there is because test names can also be strings. The confusion arises because what's being printed is not an actual symbol, but rather the test's home package followed by the name, which is a string-designator.