Skip to content

Commit

Permalink
Clean up ansi mess.
Browse files Browse the repository at this point in the history
  • Loading branch information
magnars committed Dec 19, 2012
1 parent 54f0681 commit ba7d8da
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 6 deletions.
15 changes: 11 additions & 4 deletions buster-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,18 @@
(define-key buster-mode-map
(kbd "C-c C-b ra") 'buster-run-all-tests)

(defun buster-mode--clean-up-ansi-mess (&rest ignore)
(with-current-buffer "*compilation*"
(save-excursion
(goto-char (point-min))
(while (search-forward "" nil t)
(delete-char -5)
(delete-char (- (current-column)))))))

(define-minor-mode buster-mode
"Buster mode"
nil
" Buster"
buster-mode-map)
"Buster mode" nil " Buster" buster-mode-map
(when buster-mode
(add-hook 'compilation-finish-functions 'buster-mode--clean-up-ansi-mess)))

(provide 'buster-mode)

Expand Down
3 changes: 2 additions & 1 deletion features/run-all-tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Feature: Run all tests
And I press "C-c C-b ra"
And I wait for the compilation to finish
And I switch to buffer "*compilation*"
Then I should see "0 timeouts"
Then I should see "17 tests, 19 assertions, 1 runtime ... OK"
And I should not see ""
2 changes: 1 addition & 1 deletion features/step-definitions/basic-steps.el
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@

(And "^I have passing tests$"
(lambda ()
(setq buster-compile-command "./buster-test")))
(setq buster-compile-command "cat features/stubs/passing-tests")))
36 changes: 36 additions & 0 deletions features/stubs/failing-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Running tests ...
Running 17 tests in 1 runtime ...
Failure: ANSI table draws multi-line cells
[refute.equals] """Something In this
cell
Other There is
stuff
" expected not to be equal to "Something In this
cell
Other There is
stuff
"
at Object.referee.fail (/home/christian/projects/busterjs/modules/referee/lib/referee.js:156:25)
at Object.fail (/home/christian/projects/busterjs/modules/referee/lib/referee.js:43:17)
at Function.referee.(anonymous function).(anonymous function) [as equals] (/home/christian/projects/busterjs/modules/referee/lib/referee.js:86:29)
at Object.buster.testCase.draws multi-line cells (./test/ansi-table-test.js:92:16)
at asyncFunction (/home/christian/projects/busterjs/modules/buster-test/lib/test-runner.js:230:19)
at callTestFn (/home/christian/projects/busterjs/modules/buster-test/lib/test-runner.js:340:27)
at p.then (/home/christian/projects/busterjs/modules/buster-test/node_modules/when/when.js:71:31)
at Object.then (/home/christian/projects/busterjs/modules/buster-test/node_modules/when/when.js:177:11)
at Object.bane.createEventEmitter.runTest (/home/christian/projects/busterjs/modules/buster-test/lib/test-runner.js:608:26)
at Object.bane.createEventEmitter.runTests (/home/christian/projects/busterjs/modules/buster-test/lib/test-runner.js:576:29)
Running 17 tests in 1 runtime ... 6% done
Running 17 tests in 1 runtime ... 12% done
Running 17 tests in 1 runtime ... 12% done
Running 17 tests in 1 runtime ... 35% done
Running 17 tests in 1 runtime ... 35% done
Running 17 tests in 1 runtime ... 47% done
Running 17 tests in 1 runtime ... 47% done
Running 17 tests in 1 runtime ... 53% done
Running 17 tests in 1 runtime ... 53% done
Running 17 tests in 1 runtime ... 59% done
Running 17 tests in 1 runtime ... 59% done
Running 17 tests in 1 runtime ... 88% done
Running 17 tests in 1 runtime ... 88% done
17 tests, 18 assertions, 1 runtime ... 1 failure
15 changes: 15 additions & 0 deletions features/stubs/passing-tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Running tests ...
Running 17 tests in 1 runtime ...
Running 17 tests in 1 runtime ... 12% done
Running 17 tests in 1 runtime ... 12% done
Running 17 tests in 1 runtime ... 18% done
Running 17 tests in 1 runtime ... 18% done
Running 17 tests in 1 runtime ... 35% done
Running 17 tests in 1 runtime ... 35% done
Running 17 tests in 1 runtime ... 47% done
Running 17 tests in 1 runtime ... 47% done
Running 17 tests in 1 runtime ... 76% done
Running 17 tests in 1 runtime ... 76% done
Running 17 tests in 1 runtime ... 82% done
Running 17 tests in 1 runtime ... 82% done
17 tests, 19 assertions, 1 runtime ... OK

0 comments on commit ba7d8da

Please sign in to comment.