all repos — min @ master

A small but practical concatenative programming language.

tests/xml.min

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
'min-test require :test
;;;


"xml" *test/describe

  ("test" xentity /text "test" ==) *test/assert

  ("test" xcomment /text "test" ==) *test/assert

  ("test" xtext /text "test" ==) *test/assert

  ("test" xcdata /text "test" ==) *test/assert

  ("test" xelement /tag "test" ==) *test/assert

  (
   "test" xelement :xnode
   xnode {"a" :attr1} %attributes @xnode
   "a1" xelement :child
   "text..." xtext :text
   xnode (child text) => %children @xnode
   xnode to-xml 
   "<test attr1=\"a\"><a1 />text...</test>" == ) *test/assert

   (
    "<ul><li class='test'>yes</li><li class='test'>...</li><li>no</li></ul>" from-xml :xnode
    xnode "li.test" xquery 
    /children first /text "yes" ==
   ) *test/assert

   (
    "<ul><li class='test'>yes</li><li class='test'>...</li><li>no</li></ul>" from-xml :xnode
    xnode "li.test" xqueryall 
    size 2 ==
   ) *test/assert

  *test/report
  clear-stack