Disclaimer

The content of this blog is my personal opinion only. Although I am an employee - currently of Nvidia, in the past of other companies such as Iagination Technologies, MIPS, Intellectual Ventures, Intel, AMD, Motorola, and Gould - I reveal this only so that the reader may account for any possible bias I may have towards my employer's products. The statements I make here in no way represent my employer's position, nor am I authorized to speak on behalf of my employer. In fact, this posting may not even represent my personal opinion, since occasionally I play devil's advocate.

See http://docs.google.com/View?id=dcxddbtr_23cg5thdfj for photo credits.

Friday, December 11, 2015

Finally got emacs compilation-error-regexp working for perl CPAN Test::Unit::TestCase

Summary: Finally got emacs compilation-error-regexp working for perl CPAN Test::Unit::TestCase



Not only did I need to add a regexp,
but I also needed to disable a compilation-mode-font-lock-keywords pattern
- apparently there may be some phase ordering.

This woukd be more reliably if there were the ability to return ALL possible substrings matching a regexp,
as opposed to being maximally or minimally greedy.

    ;; adding patterns to compilation-error-regexp-alist and/or compilation-error-regexp-alist
    ;; to try to get a perl CPAN Test::Unit error message, like

    ;; There were 3 failures:
    ;; 1) TestCases_for_FrameMaker_MIF_AG.pm:875 - test_another_error(TestCases_for_AG_FrameMaker_MIF)
    ;; expected '', got 'deliberate mismatch'
    ;;
    ;; 2) TestCases_for_FrameMaker_MIF_AG.pm:879 - test_yet_another_error(TestCases_for_AG_FrameMaker_MIF)
    ;; expected '', got 'deliberate mismatch'
    ;;
    ;; 3) TestCases_for_FrameMaker_MIF_AG.pm:898 - test_special_stuff__format_tuple_to_MIF_string__Cell_context__WIP(TestCases_for_AG_FrameMaker_MIF)

    (require 'compile)

    (add-to-list 'compilation-error-regexp-alist
'("\nThere were [0-9]+ failures:\n1) \\([a-zA-Z0-9_.-.---]+\\):\\([0-9]+\\) - test_"
  1 2)
    (add-to-list 'compilation-error-regexp-alist
'("\n[0-9]+) \\([a-zA-Z0-9_.-.---]+\\):\\([0-9]+\\) - test_"
  1 2)
      )
    (if nil  ;; the regexp below causes compilation-error-regexp-alist to stop working completely - no matching
      (add-to-list 'compilation-error-regexp-alist
'("\nThere were [0-9]+ failures:\n1) .*\\(\\w\\|\\W)*\n[0-9]+) .*\\(test_\\)"
  2)
)
      )


Diffs:


    === modified file '.emacs'
    *** .emacs 2015-12-12 00:18:53 +0000
    --- .emacs 2015-12-12 00:26:30 +0000
    ***************
    *** 4129,4139 ****
     ;; perl CPAN Test::Unit
     ;; 1) TestCases_for_FrameMaker_MIF_AG.pm:763 - test_special_stuff_to_insert_wip(TestCases_for_AG_FrameMaker_MIF)
     '(("\\([a-zA-Z0-9_.-.---]+:[0-9]+\\)"
    !      ;;(0 'compilation-line-face nil t)
    !      ;; (0 'ag-test-result-unexpected) ;; works (modulo filename matching)
    !      ;;(1 'ag-test-result-unexpected) ;; works (modulo filename regexp
    !      (1 compilation-line-face nil t)
    !      ))
     '(("expected\s+.*got\s+.*"
 (0 'ag-test-result-unexpected)
 ))
    --- 4129,4139 ----
     ;; perl CPAN Test::Unit
     ;; 1) TestCases_for_FrameMaker_MIF_AG.pm:763 - test_special_stuff_to_insert_wip(TestCases_for_AG_FrameMaker_MIF)
     '(("\\([a-zA-Z0-9_.-.---]+:[0-9]+\\)"
    ! ;;      ;;(0 'compilation-line-face nil t)
    ! ;;      ;; (0 'ag-test-result-unexpected) ;; works (modulo filename matching)
    ! ;;      ;;(1 'ag-test-result-unexpected) ;; works (modulo filename regexp
    ! ;;      (1 compilation-line-face nil t)
    ! ;;      ))
     '(("expected\s+.*got\s+.*"
 (0 'ag-test-result-unexpected)
 ))
    ***************
    *** 4628,4637 ****
      (add-to-list 'compilation-error-regexp-alist
 '("\nThere were [0-9]+ failures:\n1) \\([a-zA-Z0-9_.-.---]+\\):\\([0-9]+\\) - test_"
    1 2)
)
    ! (if nil
(add-to-list 'compilation-error-regexp-alist
    !     '("\nThere were [0-9]+ failures:\n1) .*\\(\\w\\|\\W)*\n[0-9]+) \\([a-zA-Z0-9_.-.---]+\\):\\([0-9]+\\) - test_) "
    !        2 3)
 )
)
    --- 4628,4640 ----
      (add-to-list 'compilation-error-regexp-alist
 '("\nThere were [0-9]+ failures:\n1) \\([a-zA-Z0-9_.-.---]+\\):\\([0-9]+\\) - test_"
    1 2)
    + (add-to-list 'compilation-error-regexp-alist
    +     '("\n[0-9]+) \\([a-zA-Z0-9_.-.---]+\\):\\([0-9]+\\) - test_"
    +        1 2)
)
    ! (if nil  ;; the regexp below causes compilation-error-regexp-alist to stop working completely - no matching
(add-to-list 'compilation-error-regexp-alist
    !     '("\nThere were [0-9]+ failures:\n1) .*\\(\\w\\|\\W)*\n[0-9]+) .*\\(test_\\)"
    !        2)
 )
)



No comments: