@@ -74,6 +74,35 @@ int taxed_value() {
7474 assertEquals (getContents (root , "unambiguoussimple.txt" ), sw .toString ());
7575 }
7676
77+ @ Test
78+ public void testSimpleUnexecuteEncoded () throws MustacheException , IOException {
79+ MustacheJava c = init ();
80+ Mustache m = c .parseFile ("unambiguoussimple.html" );
81+ StringWriter sw = new StringWriter ();
82+ m .execute (sw , new Scope (new Object () {
83+ String name = "<Chris>" ;
84+ int value = 10000 ;
85+
86+ int taxed_value () {
87+ return (int ) (this .value - (this .value * 0.4 ));
88+ }
89+
90+ boolean in_ca = true ;
91+ }));
92+ assertEquals (getContents (root , "unambiguoussimpleencoded.txt" ), sw .toString ());
93+
94+ Scope scope = m .unexecute (sw .toString ());
95+ assertEquals ("<Chris>" , scope .get ("name" ));
96+ assertEquals ("10000" , scope .get ("value" ));
97+ Scope in_ca = new Scope ();
98+ in_ca .put ("taxed_value" , "6000" );
99+ assertEquals (Arrays .asList (in_ca ), scope .get ("in_ca" ));
100+
101+ sw = new StringWriter ();
102+ m .execute (sw , scope );
103+ assertEquals (getContents (root , "unambiguoussimpleencoded.txt" ), sw .toString ());
104+ }
105+
77106 @ Test
78107 public void testComplexUnexecute () throws MustacheException , IOException {
79108 Scope scope = new Scope (new Object () {
0 commit comments