Sfoglia il codice sorgente

add test suite, implement escaping

tags/0.1
Jan Lehnardt 16 anni fa
parent
commit
50f8035e3e
9 ha cambiato i file con 29 aggiunte e 14 eliminazioni
  1. +5
    -4
      Rakefile
  2. +1
    -0
      examples/comments.txt
  3. +3
    -9
      examples/complex.js
  4. +7
    -1
      examples/complex.txt
  5. +5
    -0
      examples/escaped.js
  6. +1
    -0
      examples/escaped.txt
  7. +1
    -0
      examples/simple.txt
  8. +5
    -0
      examples/unescaped.js
  9. +1
    -0
      examples/unescaped.txt

+ 5
- 4
Rakefile Vedi File

@@ -3,8 +3,9 @@ require 'rake/testtask'
task :default => :test

Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
Dir.glob("examples/*.html") do |file|
test = File.basename(file, ".html")
cmd = "ruby test/mustache_test.rb #{test}"
print `#{cmd}`
end
end


+ 1
- 0
examples/comments.txt Vedi File

@@ -1 +1,2 @@
<h1>A Comedy of Errors{{! just something interesting... or not... }}</h1>


+ 3
- 9
examples/complex.js Vedi File

@@ -8,18 +8,12 @@ var complex = {
{name: "blue", current: false, url: "#Blue"}
],
link: function() {
var v = this["current"] === true;
// print("link() returns " + v);
return v;
return this["current"] !== true;
},
list: function() {
var v = this.item.length !== 0;
// print("list() returns " + v);
return v;
return this.item.length !== 0;
},
empty: function() {
var v = this.item.length === 0;
// print("empty() returns " + v);
return v;
return this.item.length === 0;
}
};

+ 7
- 1
examples/complex.txt Vedi File

@@ -1 +1,7 @@
<h1>Colors</h1> <ul> <li><strong>red</strong></li> <li><a href="#Green">green</a></li> <li><a href="#Blue">blue</a></li> </ul>
<h1>Colors</h1>
<ul>
<li><strong>red</strong></li>
<li><a href="#Green">green</a></li>
<li><a href="#Blue">blue</a></li>
</ul>


+ 5
- 0
examples/escaped.js Vedi File

@@ -0,0 +1,5 @@
var escaped = {
title: function() {
return "Bear > Shark";
}
};

+ 1
- 0
examples/escaped.txt Vedi File

@@ -0,0 +1 @@
<h1>Bear &gt; Shark</h1>

+ 1
- 0
examples/simple.txt Vedi File

@@ -1,3 +1,4 @@
Hello Chris
You have just won $10000!
Well, $6000, after taxes.


+ 5
- 0
examples/unescaped.js Vedi File

@@ -0,0 +1,5 @@
var unescaped = {
title: function() {
return "Bear > Shark";
}
};

+ 1
- 0
examples/unescaped.txt Vedi File

@@ -0,0 +1 @@
<h1>Bear > Shark</h1>

Loading…
Annulla
Salva