Paste: Unit tests and global variable bindings

Author: klazuka
Mode: factor
Date: Fri, 9 Oct 2009 15:42:44
Plain Text |
! The following code does not work correctly:
! It complains that the sequence is immutable
!
! How I would like to use it:
!
! [ "span" ]
! [ [ { "span" } print-content ] with-string-writer ] markup-test
! 
! [ "span1span2" ]
! [ [ { "span1" "span2" } print-content ] with-string-writer ] markup-test
! 
! [ "span1\n\nspan2" ]
! [ [ { "span1" { $nl } "span2" } print-content ] with-string-writer ] markup-test
!
! The idea is that the "last-element" global variable should be bound to 'f' before running each unit-test.

SYNTAX: markup-test
    dup pop V{ } clone
    f parsed last-element parsed
    swap parsed \ with-variable parsed
    >quotation parsed \ unit-test parsed ;

New Annotation

Summary:
Author:
Mode:
Body: