Skip to content

Latest commit

 

History

History
90 lines (75 loc) · 1.41 KB

tips.adoc

File metadata and controls

90 lines (75 loc) · 1.41 KB

Usage Writing Tips

  • As mentionined in the README, the basic form is:

    (comment
    
      (- 1 1)
      # => 0
    
    )

    Within a comment block, express a test as a pair of 1) a form and 2) an appropriate comment. Thus, (- 1 1) is a form to be tested and # ⇒ 0 expresses that 0 is the expected value.

  • Use '() or [] instead of () in some places when expressing expected values, e.g.

    # => '(:hi 1)

    or:

    # => [:hi 1]

    not:

    # => (:hi 1)
  • More than one expression + expected value comment pair (comment block test) can be placed in a comment block. For example, for the following:

    (comment
    
      (+ 1 1)
      # => 2
    
      (- 1 1)
      # => 0
    
    )

    two tests will be created and executed.

  • It’s also fine to put other forms in the comment block that don’t have expected value comments appearing directly after them. All such forms will be executed. For example, in the following:

    (comment
    
      (def a 1)
    
      (+ a 1)
      # => 2
    
    )

    (def a 1) will be executed during testing.

  • However, if a comment block has no tests (i.e. no expected values indicated), the forms within the comment block will NOT be executed. Thus, for the following:

    (comment
    
      (print "hi")
    
    )

    since there are no expected values indicated, (print "hi") will NOT be executed.