File: template.t

package info (click to toggle)
nqp 2014.07-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 23,596 kB
  • ctags: 7,993
  • sloc: ansic: 22,689; java: 20,240; cpp: 4,956; asm: 3,976; perl: 950; python: 267; sh: 245; makefile: 14
file content (23 lines) | stat: -rwxr-xr-x 637 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# eRubyish style templates

puts '1..10'
puts "ok 1 - statements before template"

<?rbi?>
ok 2 - initial template text
  <%n = 2 %>
  <%while (n+=1) < 5 %>ok #{n} - while loop test
  <%end%>
ok 5 - text between statements
  <%if n == 5 %>ok 6 - if block (true)
  <%else      %>nok 6 - else block (true)
  <%end%>
  <%if    n == 1234 %>nok 7 - if block (false)
  <%elsif n == 20   %>nok 7 - elsif block (false)
  <%else            %>ok 7 - else block (false)
  <% end %>
  <%for test in [8, 9] do %>ok #{test} - for loop test
  <%end%>
  <%n = 9 %>
<%#puts "nok #{n += 1} - commented out directive" %>
ok #{n += 1} - final template text