Sha256: a825b0d8a81be35d1e0d6cd6bd428cf535463b6c490fc0d3ad73c5eddcab0c81
Contents?: true
Size: 1.22 KB
Versions: 8
Compression:
Stored size: 1.22 KB
Contents
$LOAD_PATH.unshift File.dirname(__FILE__) require 'helper' class ParserTest < Test::Unit::TestCase def test_parser lexer = Mustache::Parser.new tokens = lexer.compile(<<-EOF) <h1>{{header}}</h1> {{#items}} {{#first}} <li><strong>{{name}}</strong></li> {{/first}} {{#link}} <li><a href="{{url}}">{{name}}</a></li> {{/link}} {{/items}} {{#empty}} <p>The list is empty.</p> {{/empty}} EOF expected = [:multi, [:static, "<h1>"], [:mustache, :etag, "header"], [:static, "</h1>\n"], [:mustache, :section, "items", [:multi, [:mustache, :section, "first", [:multi, [:static, "<li><strong>"], [:mustache, :etag, "name"], [:static, "</strong></li>\n"]]], [:mustache, :section, "link", [:multi, [:static, "<li><a href=\""], [:mustache, :etag, "url"], [:static, "\">"], [:mustache, :etag, "name"], [:static, "</a></li>\n"]]]]], [:mustache, :section, "empty", [:multi, [:static, "<p>The list is empty.</p>\n"]]]] assert_equal expected, tokens end end
Version data entries
8 entries across 8 versions & 2 rubygems