Add lambda context tests
diff --git a/test/mustache_test.dart b/test/mustache_test.dart
index 57e24a0..35904c9 100644
--- a/test/mustache_test.dart
+++ b/test/mustache_test.dart
@@ -194,6 +194,7 @@
test('Bad tag', () {
expect(() => new Template('{{{ foo }|'), throwsException);
});
+
});
group('Inverse Section', () {
@@ -561,6 +562,20 @@
expect(parse(template).renderString(values), equals(output));
});
+
+ test('LambdaContext.lookup', () {
+ var t = new Template('{{ foo }}');
+ var s = t.renderString({'foo': (lc) => lc.lookup('bar'), 'bar': 'jim'});
+ expect(s, equals('jim'));
+ });
+
+ test('LambdaContext.lookup closed', () {
+ var t = new Template('{{ foo }}');
+ var lc2;
+ var s = t.renderString({'foo': (lc) => lc2 = lc, 'bar': 'jim'});
+ expect(() => lc2.lookup('foo'), throwsException);
+ });
+
});
group('Other', () {