ruco 0.2.0.beta → 0.2.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,46 +0,0 @@
1
- require File.expand_path('spec/spec_helper')
2
-
3
- describe Ruco::ArrayProcessor do
4
- let(:p){ Ruco::ArrayProcessor.new }
5
- before do
6
- p.new_line('xxx')
7
- end
8
-
9
- it "is empty by default" do
10
- p.lines.should == [[]]
11
- end
12
-
13
- it "parses simple syntax" do
14
- p.open_tag('xxx',0)
15
- p.close_tag('xxx',3)
16
- p.lines.should == [[['xxx',0...3]]]
17
- end
18
-
19
- it "parses nested syntax" do
20
- p.open_tag('xxx',0)
21
- p.open_tag('yyy',2)
22
- p.close_tag('yyy',3)
23
- p.close_tag('xxx',3)
24
- p.lines.should == [[["yyy", 2...3], ["xxx", 0...3]]]
25
- end
26
-
27
- it "parses multiline syntax" do
28
- p.open_tag('xxx',0)
29
- p.close_tag('xxx',3)
30
- p.new_line('xxx')
31
- p.open_tag('xxx',1)
32
- p.close_tag('xxx',2)
33
- p.lines.should == [
34
- [["xxx", 0...3]],
35
- [["xxx", 1...2]]
36
- ]
37
- end
38
-
39
- it "parses multiply nested syntax" do
40
- p.open_tag('yyy',0)
41
- p.open_tag('yyy',2)
42
- p.close_tag('yyy',3)
43
- p.close_tag('yyy',3)
44
- p.lines.should == [[["yyy", 2...3], ["yyy", 0...3]]]
45
- end
46
- end
@@ -1,74 +0,0 @@
1
- require File.expand_path('spec/spec_helper')
2
-
3
- describe Ruco::SyntaxParser do
4
- def parse(text, languages=['ruby'])
5
- Ruco::SyntaxParser.syntax_for_lines(text, languages)
6
- end
7
-
8
- describe :parse_lines do
9
- it "shows positions for simple lines" do
10
- parse(["class Foo","end"]).should == [[
11
- ["keyword.control.class.ruby", 0...5],
12
- ["entity.name.type.class.ruby", 6...9],
13
- ["meta.class.ruby", 0...9]],
14
- [["keyword.control.ruby", 0...3]
15
- ]]
16
- end
17
-
18
- it "shows positions for complicated lines" do
19
- parse(["class foo end blob else Foo"]).should == [[
20
- ["keyword.control.class.ruby", 0...5],
21
- ["entity.name.type.class.ruby", 6...9],
22
- ["meta.class.ruby", 0...9],
23
- ["keyword.control.ruby", 10...13],
24
- ["keyword.control.ruby", 19...23],
25
- ["variable.other.constant.ruby", 24...27]
26
- ]]
27
- end
28
-
29
- it "does not show keywords in strings" do
30
- parse(["Bar 'Bar' foo"]).should == [[
31
- ["variable.other.constant.ruby", 0...3],
32
- ["punctuation.definition.string.begin.ruby", 4...5],
33
- ["punctuation.definition.string.end.ruby", 8...9],
34
- ["string.quoted.single.ruby", 4...9]
35
- ]]
36
- end
37
-
38
- it "does not show strings in comments" do
39
- parse(["'Bar' # 'Bar'"]).should == [[
40
- ["punctuation.definition.string.begin.ruby", 0...1],
41
- ["punctuation.definition.string.end.ruby", 4...5],
42
- ["string.quoted.single.ruby", 0...5],
43
- ["punctuation.definition.comment.ruby", 6...7],
44
- ["comment.line.number-sign.ruby", 6...13]
45
- ]]
46
- end
47
-
48
- it "shows multiline comments" do
49
- parse(["=begin","1 : 2","=end"]).should == [
50
- [["punctuation.definition.comment.ruby", 0...6], ["comment.block.documentation.ruby", 0...7]],
51
- [["comment.block.documentation.ruby", 0...6]],
52
- [["punctuation.definition.comment.ruby", 0...4], ["comment.block.documentation.ruby", 0...4]]
53
- ]
54
- end
55
-
56
- it "continues multiline on last line before closing it" do
57
- parse(["%Q{\n\na }"]).should == [
58
- [["punctuation.definition.string.begin.ruby", 0...3], ["string.quoted.double.ruby.mod", 0...4]],
59
- [["string.quoted.double.ruby.mod", 0...1]],
60
- [["punctuation.definition.string.end.ruby", 3...4], ["string.quoted.double.ruby.mod", 0...4]]
61
- ]
62
- end
63
-
64
- it "can handle unfound syntaxes" do
65
- parse('aaaa', ['fooo']).should == []
66
- end
67
- end
68
-
69
- describe :syntax_nodes do
70
- it "detects languages not present in ultraviolet" do
71
- Ruco::SyntaxParser.syntax_node(['html+erb']).should_not == nil
72
- end
73
- end
74
- end
@@ -1,14 +0,0 @@
1
- require File.expand_path('spec/spec_helper')
2
-
3
- describe Ruco::TMTheme do
4
- let(:theme){ Ruco::TMTheme.new('spec/fixtures/test.tmTheme') }
5
-
6
- it "parses foreground/background" do
7
- theme.foreground.should == '#4D4D4C'
8
- theme.background.should == '#FFFFFF'
9
- end
10
-
11
- it "parses rules" do
12
- theme.styles["keyword.operator.class"].should == ['#666969', nil]
13
- end
14
- end