Move History

Fork Selected
  • Code
    USING: kernel parser sequences quotations prettyprint fry ;
    QUALIFIED-WITH: tools.testest tt
    IN: testest.extras
    
    
    : wrap-it ( quot -- wrapped )
      '[ tt:it#{ _ dip tt:}# ] ;
      
    : wrap-describe ( quot -- wrapped )
      '[ tt:describe#{ _ dip tt:}# ] ;
    
    SYNTAX: it#{ \ tt:}# parse-until >quotation wrap-it suffix! \ call suffix! ;
    SYNTAX: describe#{ \ tt:}# parse-until >quotation wrap-describe suffix! \ call suffix! ;
    
    
    Test Cases Failed
    USING: kernel tools.testest math prettyprint io ;
    QUALIFIED-WITH: testest.extras te
    IN: testest.tests
    
    : run-tests ( -- )
      "Example" te:describe#{
        "hello" te:it#{
          <{ 1 1 + -> 2 }>
        }#
        
        "fail" te:it#{
          <{ 1 1 + -> 3 }>
        }#
        
        "nested describe" te:describe#{
          "pass" te:it#{
            
            <{ 1 1 + -> 2 }>
          }#
    
          "fail" te:it#{
          
            ! Nothing on the stack
            "Nothing on the stack!" print
            get-datastack .
            
            <{ 1 1 + -> 3 }>
          }#
    
        }#
      }#
    ;
    
    MAIN: run-tests