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