oakmac / parinfer-elisp

Parinfer in Emacs Lisp
ISC License
97 stars 3 forks source link

Test suite update #13

Open Kurvivor19 opened 6 years ago

Kurvivor19 commented 6 years ago

Currently test suite for parinfer makes certain assumptions about test data, as expressed here:

(defun run-test (mode test) (let* ((mode-string (if (equal :indent mode) "Indent Mode" "Paren Mode")) (in (plist-get test :in)) (out (plist-get test :out)) (out-cursor (plist-get out :cursor)) (out-error (plist-get out :error)) (out-tabstops (plist-get out :tabStops)) (test-id (number-to-string (plist-get in :fileLineNo))) (in-text (string-join (plist-get in :lines))) (expected-text (string-join (plist-get out :lines))) (in-cursor (plist-get in :cursor)) (cursor-x (plist-get in-cursor :cursorX)) (cursor-line (plist-get in-cursor :cursorLine)) (cursor-dx (plist-get in-cursor :cursorDx))

However, in test cases, data structure does not have those fields listed, for example:

{ "in": { "fileLineNo": 927, "text": "(let [a {:foo 1}\n bar [1 2 3]]\n |\n bar)" }, "out": { "fileLineNo": 934, "text": "(let [a {:foo 1}\n bar [1 2 3]]\n^ ^ ^ tabStops\n |\n bar)" }

Instead cursor position, tab stops, last changes (for smart mode) are described in text, on specially formatted lines

For proper test running, it is necessary to update test suite