Skip to content

Commit

Permalink
update fixtures , use new handlebars ( handlebars-lang/handlebars.js#731
Browse files Browse the repository at this point in the history
 resolved )
  • Loading branch information
Zordius Chen committed Jul 8, 2014
1 parent 8adc63c commit b4b9820
Show file tree
Hide file tree
Showing 23 changed files with 105 additions and 41 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Click on the chart for more details.
Requirements
------------

* php 5.3+ with json and mbstring suppport.
* php 5.3+

* [optional] nodejs04+ and handlebars for fixture generation.
( npm install handlebars )

* [optional] nodejs06+ and amanda for json schema validation.
( npm install amanda )
```
wget http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars-c90cfe2.js -O handlebars.js
bin/generate-fixture
```

Quick Conclusion
----------------
Expand Down Expand Up @@ -72,8 +72,6 @@ Feature Comparison
* QUOTE : Encode ' to ', not to ' (minor issue)
* SINGLEQUOTE : Do not encode ' to '

* SPECIAL NOTE: now (2014-02-11) case 003-simple-else-005 , 006-simple-section-003 , 018-hb-withwith-004 , 021-hb-manyparent-004 , 025-hb-particalparent-001, 025-hb-particalparent-002, 027-hb-arrayindex-003 results are not 'YES' but 'OUTPUT'. We can not ensure the handlebars.js 1.3.0+ behavior is correct or not. Now we open an issue to track this: https://github.com/wycats/handlebars.js/issues/731

| test case | handlebars.php | lightncandy | mustache-php | mustache.php |
|-----------------------|-----------------------|-----------------------|-----------------------|---------------------|
| 001-simple-vars-001 | YES | YES | OUTPUT | YES |
Expand Down
4 changes: 3 additions & 1 deletion bin/generate-fixture
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

var fs = require('fs'),
handlebars = require('handlebars'),
handlebars = require('../handlebars.js').Handlebars,
dir = 'fixture/',
partial_total = 0,
partial_ok = 0,
Expand Down Expand Up @@ -47,6 +47,8 @@ var fs = require('fs'),
});
};

console.log(handlebars);

handlebars.registerHelper('helper1', function (url, text) {
return '<a href="' + url + '">' + text + '</a>';
});
Expand Down
2 changes: 1 addition & 1 deletion cloned/lightncandy
Submodule lightncandy updated from 47cd6b to 7a0d7d
2 changes: 1 addition & 1 deletion fixture/003-simple-else-005.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Hello John, you have just won $10000!
This is next line.

This is true! won $0!!
This is true! won $!!


1 change: 1 addition & 0 deletions fixture/005-simple-escape-001.lightncandy.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Hello John, you have just won $10000!
Hello original John , the value is 10000
Hello mustache John , the value is 10000
1 change: 1 addition & 0 deletions fixture/005-simple-escape-001.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Hello John, you have just won $10000!
Hello original John , the value is 10000
Hello mustache John , the value is 10000
1 change: 1 addition & 0 deletions fixture/005-simple-escape-002.lightncandy.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Hello John中文, you have just won $&lt;10000&gt;!
Hello original John中文 , the value is <10000>
Hello mustache John中文 , the value is <10000>
1 change: 1 addition & 0 deletions fixture/005-simple-escape-002.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Hello John中文, you have just won $&lt;10000&gt;!
Hello original John中文 , the value is <10000>
Hello mustache John中文 , the value is <10000>
2 changes: 2 additions & 0 deletions fixture/005-simple-escape-003.lightncandy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ Hello John
&quot;中文&quot;, you have just won $&lt;&#x27;10000&#x27;&gt;&amp;?!
Hello original John
"中文" , the value is <'10000'>&?
Hello mustache John
"中文" , the value is <'10000'>&?
2 changes: 2 additions & 0 deletions fixture/005-simple-escape-003.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ Hello John
&quot;中文&quot;, you have just won $&lt;&#x27;10000&#x27;&gt;&amp;?!
Hello original John
"中文" , the value is <'10000'>&?
Hello mustache John
"中文" , the value is <'10000'>&?
1 change: 1 addition & 0 deletions fixture/005-simple-escape.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
);
return 'Hello '.LCRun3::encq($cx, LCRun3::v($cx, $in, Array('name'))).', you have just won $'.LCRun3::encq($cx, LCRun3::v($cx, $in, Array('value'))).'!
Hello original '.LCRun3::raw($cx, LCRun3::v($cx, $in, Array('name'))).' , the value is '.LCRun3::raw($cx, LCRun3::v($cx, $in, Array('value'))).'
Hello mustache '.LCRun3::raw($cx, LCRun3::v($cx, $in, Array('name'))).' , the value is '.LCRun3::raw($cx, LCRun3::v($cx, $in, Array('value'))).'
';
}
?>
1 change: 1 addition & 0 deletions fixture/005-simple-escape.tmpl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Hello {{name}}, you have just won ${{value}}!
Hello original {{{name}}} , the value is {{{value}}}
Hello mustache {{&name}} , the value is {{&value}}
2 changes: 1 addition & 1 deletion fixture/006-simple-section-003.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hello John, you have just won $10000!
<ul>

<li>0 is a 0</li>
<li> is a </li>

</ul>

16 changes: 16 additions & 0 deletions fixture/007-simple-sections-005.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"notEmpty": true,
"item": [
{
"name": "OK!"
},
{
"current": [
"A", "B"
]
},
{
"current": []
}
]
}
24 changes: 24 additions & 0 deletions fixture/007-simple-sections-005.lightncandy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<h1></h1>

<ul>



<li><a href="">OK!</a></li>



<li><strong></strong></li>

<li><strong></strong></li>





<li><a href=""></a></li>


</ul>


24 changes: 24 additions & 0 deletions fixture/007-simple-sections-005.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<h1></h1>

<ul>



<li><a href="">OK!</a></li>



<li><strong></strong></li>

<li><strong></strong></li>





<li><a href=""></a></li>


</ul>


10 changes: 4 additions & 6 deletions fixture/018-hb-withwith-004.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@
~WITH

~TEST~
0
0


~IF~

NO
~SEC~

0

~EACH~

~END~
Expand All @@ -26,9 +24,9 @@ WITH~

_WITH PATH_

XTEST: 0 - 0
XTEST: -
IF: NO!
SECTION:: - loop: 0
SECTION::
EACH::
END!

Expand Down
28 changes: 10 additions & 18 deletions fixture/021-hb-manyparent-004.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,24 +93,22 @@ Hello , you have just won $!
UNLESS good = bad -> ,


<li>0 is a 0 (, , )</li>
<li> is a (, , )</li>
simple if~

if-else

BAD! 0 0 - 0 Y =
BAD! - Y =

with

WITH: 0, 0 , ,

simple unless

UNLESS good = bad -> 0 ,
UNLESS good = bad -> ,

unless else

UNLESS good = bad -> 0 ,
UNLESS good = bad -> ,


<li> is a (, , )</li>
Expand Down Expand Up @@ -165,12 +163,10 @@ Hello , you have just won $!



<li>0 is a 0 (, , )</li>

BAD! 0 0 - 0 Y =
<li> is a (, , )</li>

BAD! - Y =

WITH: 0 , ,


<li> is a (, , )</li>
Expand Down Expand Up @@ -213,12 +209,10 @@ Hello , you have just won $!



<li>0 is a 0 (, , )</li>

BAD! 0 0 - 0 Y =
<li> is a (, , )</li>

BAD! - Y =

WITH: 0 , ,


<li> is a (, , )</li>
Expand Down Expand Up @@ -261,12 +255,10 @@ Hello , you have just won $!



<li>0 is a 0 (, , )</li>

BAD! 0 0 - 0 Y =
<li> is a (, , )</li>

BAD! - Y =

WITH: 0 , ,


<li> is a (, , )</li>
Expand Down
4 changes: 2 additions & 2 deletions fixture/027-hb-arrayindex-003.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Hello John, you have just won $10000!

- EACH 1-

- EACH 1- 0
- EACH 1-

- EACH 1-

Expand All @@ -32,7 +32,7 @@ end section.

- EACH 2 -

- EACH 2 - 0
- EACH 2 -

- EACH 2 -

Expand Down
2 changes: 1 addition & 1 deletion fixture/029-hb-quotedarg-001.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hello John, you have just won $10000!

. Test 1: !!
. Test 2: !!
. Test 2: 0 !!
. Test 3: !!
. Test 4: !!
. Test 5: <a href="undefined">this is a test & OK</a> !!
Expand Down
2 changes: 1 addition & 1 deletion fixture/029-hb-quotedarg-002.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hello John, you have just won $10000!

. Test 1: !!
. Test 2: !!
. Test 2: 0 !!
. Test 3: !!
. Test 4: OK !!
. Test 5: <a href="about:blank">this is a test & OK</a> !!
Expand Down
2 changes: 1 addition & 1 deletion fixture/029-hb-quotedarg-003.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Hello John, you have just won $10000!

. Test 1: !!
. Test 2: !!
. Test 2: 0 !!
. Test 3: !!
. Test 4: OK !!
. Test 5: <a href="about:blank">this is a test & OK</a> !!
Expand Down
2 changes: 1 addition & 1 deletion fixture/032-hb-helper-001.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ Hello John, you have just won $10000!

. Test 1: <a href="undefined">undefined</a>
. Test 2: &lt;a href=&quot;undefined&quot;&gt;undefined&lt;/a&gt;
. Test 3: &lt;a href=&quot;undefined&quot;&gt;undefined&lt;/a&gt;
. Test 3: &lt;a href=&quot;0&quot;&gt;0&lt;/a&gt;
. Test 4:

0 comments on commit b4b9820

Please sign in to comment.