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
;; Current version -- note the use of `when-valid`... it is essentially duplicating the work the | |
;; syntax-validation-m monad should be able to handle, so I've been attempting to | |
;; clean it up / refactor it to use only the monad | |
(defmacro expect | |
"Run the call form, check that all the mocks defined in the fakes | |
(probably with 'fake') have been satisfied, and check that the actual | |
results are as expected. If the expected results are a function, it | |
will be called with the actual result as its single argument. |
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
;; Current version -- note the use of `when-valid`... it is essentially duplicating the work the | |
;; syntax-validation-m monad should be able to handle, so I've been attempting to | |
;; clean it up / refactor it to use only the monad | |
(defmacro expect | |
"Run the call form, check that all the mocks defined in the fakes | |
(probably with 'fake') have been satisfied, and check that the actual | |
results are as expected. If the expected results are a function, it | |
will be called with the actual result as its single argument. |
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
# An example of Mutual Recursion. | |
# A simple lexer for our parser. We only return tokens for :numbers | |
# and +, - and new lines. | |
class Lexer | |
attr_reader :token, :type | |
def initialize(stream) | |
@stream = stream | |
@tokens = [] |