
This week I'm revisiting the very first thing I wrote in Mathematica, a documentation testing package. A quick initial survey revealed a vast panorama of tottering kluge towers built high atop mountains of cruft. It's been very pleasing to retain the odd little working pieces and utterly trash the rest of the infrastructure in favor of a tidy little routine that handles more in a dozen lines of code than what I initially squeezed into 600 lines of bizarre rigamarole.
Here it is, all boiled down to the uttermost simplicity:
RunTests[dir_String, tests_List] := Module[{manifest, res}, manifest = FileNames[{"*.nb"}, dir, Infinity]; res = Reap[Module[{nb, nbExpr}, nb = #; nbExpr = Quiet@Get@nb; Module[{test}, test = #; If[DocumentationCheckQ[nbExpr, test] === False, Sow[nb, test]]; ]& /@ tests; ]& /@ manifest, _, Rule][[2]]; (* return results sorted from most failures to least *) Sort[res, Length[Last[#1]] > Length[Last[#2]] &]]
15:29 | link | | |
A facility for quotation covers the absence of original thought.—Lord Peter Wimsey
Left column Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
And the Word became flesh and dwelt among us.—St John of Patmos
Right column Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.