Created
          December 30, 2016 06:52 
        
      - 
      
- 
        Save svetlyak40wt/a797e91c6d8dd0a7d3e627efdc856782 to your computer and use it in GitHub Desktop. 
    Example, how to patch 3party library on fly, converting a ordinal function into a generic.
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (setf (fdefinition 'original-report-expected-line) | |
| #'prove.reporter.list::report-expected-line) | |
| (defgeneric report-expected-line (report) | |
| (:documentation "Returns a line which describes a problem with failed test.")) | |
| (defmethod report-expected-line (report) | |
| "Default behaviour is to call original Prove's function, | |
| which formats a string, comparing two values." | |
| (original-report-expected-line report)) | |
| (setf (fdefinition 'prove.reporter.list::report-expected-line) | |
| #'report-expected-line) | |
| (defclass failed-assertion-report (prove.report:failed-test-report) | |
| ()) | |
| (defmethod report-expected-line ((report failed-assertion-report)) | |
| "Blah bla bla bla") | |
| (prove.reporter.list::report-expected-line | |
| (make-instance 'failed-assertion-report | |
| :got t | |
| :expected t)) => "Blah bla bla bla" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Thanks to
beach, from#lispchannel on freenode.