[NEW] GLSL parser
[ohcount] / test / unit / boo_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class Ohcount::BooTest < Ohcount::Test
4         def test_comment
5                 lb = [Ohcount::LanguageBreakdown.new("boo", "", "#comment", 0)]
6                 assert_equal lb, Ohcount::parse(" #comment", "boo")
7         end
8
9   def test_block_comment
10     lb = [Ohcount::LanguageBreakdown.new("boo", "", "/*comment*/", 0)]
11     assert_equal lb, Ohcount::parse(" /*comment*/", "boo")
12   end
13
14   def test_nested_block_comment
15     lb = [Ohcount::LanguageBreakdown.new("boo", "", "/* comment\n/* nested */\nstill a comment */", 0)]
16     assert_equal lb, Ohcount::parse(" /* comment\n /* nested */\n still a comment */", "boo")
17   end
18
19   def test_doc_comments
20     lb = [Ohcount::LanguageBreakdown.new("boo", "", "\"\"\"\ndoc comment\n\"\"\"", 0)]
21     assert_equal lb, Ohcount::parse("\"\"\"\ndoc comment\n\"\"\"", "boo")
22   end
23
24         def test_strings
25                 lb = [Ohcount::LanguageBreakdown.new("boo", "\"abc#not a 'comment\"", "", 0)]
26                 assert_equal lb, Ohcount::parse("\"abc#not a 'comment\"", "boo")
27         end
28
29         def test_comprehensive
30                 verify_parse("boo1.boo")
31         end
32
33         def test_comment_entities
34                 assert_equal('#comment', entities_array(" #comment", 'boo', :comment).first)
35                 assert_equal('//comment', entities_array(" //comment", 'boo', :comment).first)
36         end
37 end