PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/scalate-core/src/test/scala/org/fusesource/scalate/mustache/MustacheFunctionTest.scala

http://github.com/scalate/scalate
Scala | 36 lines | 15 code | 4 blank | 17 comment | 0 complexity | 636fa86cdba33d0a594a5021ec8b4968 MD5 | raw file
 1package org.fusesource.scalate.mustache
 2
 3/**
 4 * Copyright (C) 2009-2010 the original author or authors.
 5 * See the notice.md file distributed with this work for additional
 6 * information regarding copyright ownership.
 7 *
 8 * Licensed under the Apache License, Version 2.0 (the "License");
 9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 *     http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21import org.fusesource.scalate.TemplateTestSupport
22import java.{ util => ju }
23
24class MustacheFunctionTest extends TemplateTestSupport {
25
26  test("function test") {
27    assertMoustacheOutput(
28      "start <b>Willy</b>end",
29      "start {{#wrapped}}{{name}}{{/wrapped}} end",
30      Map(
31        "name" -> "Willy",
32        "wrapped" -> { (text: String) =>
33          <b>{ text }</b>
34        }))
35  }
36}