breakout_parser 0.0.5-x86-mingw32 → 0.0.6-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/spec/parser_spec.rb CHANGED
@@ -29,6 +29,27 @@ describe 'BreakoutParser' do
29
29
  parse(s).size.should == s.strip.size
30
30
  end
31
31
 
32
+ it "handles nil & false text well" do
33
+ parse(false).should == ""
34
+ parse(false,false).should == ""
35
+ parse("",false).should == ""
36
+ parse(nil).should == ""
37
+ parse(nil,nil).should == ""
38
+ parse("",nil).should == ""
39
+ end
40
+
41
+ it "handles nil space_name well" do
42
+ lambda{
43
+ parse("#123",nil)
44
+ }.should raise_error(TypeError)
45
+ end
46
+
47
+ it "handles false space_name well" do
48
+ lambda{
49
+ parse("#123",false)
50
+ }.should raise_error(TypeError)
51
+ end
52
+
32
53
  it "strips tailing spaces and newlines" do
33
54
  parse("aaa ").should == "aaa"
34
55
  parse("aaa\t\t\t\t\t\t").should == "aaa"
@@ -59,6 +80,42 @@ describe 'BreakoutParser' do
59
80
  parse("aaa\r\n\r\n\r\nbbb").should == "aaa" + "<br />"*3 + "bbb"
60
81
  end
61
82
 
83
+ ###############################################################################
84
+
85
+ describe "@code@" do
86
+ it "only" do
87
+ parse("@smth@").should == '<code>smth</code>'
88
+ end
89
+ it "at beginning" do
90
+ parse("@smth@\nxxx").should == '<code>smth</code><br />xxx'
91
+ end
92
+ it "in the middle of text" do
93
+ parse("xxx @smth@ yyy").should == 'xxx <code>smth</code> yyy'
94
+ end
95
+ it "parses @multiline\\nsmth@" do
96
+ parse("@multiline\nsmth@").should == "@multiline<br />smth@"
97
+ end
98
+ it "not confuses" do
99
+ parse("look at @this code@ and mail me at xxx@yyy.com").should ==
100
+ 'look at <code>this code</code> and mail me at xxx@yyy.com'
101
+ end
102
+ it "w/o closing tag" do
103
+ parse("@smth").should == '@smth'
104
+ end
105
+ it "nesting1 w/o closing tags" do
106
+ parse("@smth1 @smth2").should == '@smth1 @smth2'
107
+ end
108
+ it "nesting2 w/o closing tags" do
109
+ parse("@smth1 @smth2").should == '@smth1 @smth2'
110
+ end
111
+ it "two times" do
112
+ parse("@code1@ @code2@").should == "<code>code1</code> <code>code2</code>"
113
+ parse("@code1@ @code2@").should == "<code>code1</code> <code>code2</code>"
114
+ parse(" @code1@ @code2@ ").should == "<code>code1</code> <code>code2</code>"
115
+ parse(" @code1@ xxx @code2@ ").should == "<code>code1</code> xxx <code>code2</code>"
116
+ end
117
+ end
118
+
62
119
  ###############################################################################
63
120
 
64
121
  describe "*bold*" do
@@ -662,7 +719,7 @@ describe 'BreakoutParser' do
662
719
  s.to_s.gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }
663
720
  end
664
721
 
665
- def parse s
666
- BreakoutParser.parse(s, "test_space").strip
722
+ def parse s, space_name = "test_space"
723
+ BreakoutParser.parse(s, space_name).strip
667
724
  end
668
725
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breakout_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Andrey "Zed" Zaikin
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-05 00:00:00 +05:00
12
+ date: 2010-02-25 00:00:00 +05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency