ruco 0.1.14 → 0.2.0.beta

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.
@@ -29,6 +29,17 @@ describe Ruco::StyleMap do
29
29
  ]
30
30
  end
31
31
 
32
+ it "reproduces styles with same style repeated" do
33
+ map.add(:red, 1, 2..4)
34
+ map.add(:red, 1, 6..7)
35
+ # red 2,3,4 normal on 5 red on 6,7
36
+ map.flatten.should == [
37
+ nil,
38
+ [nil, nil, :red, nil, nil, :normal, :red, nil, :normal],
39
+ nil
40
+ ]
41
+ end
42
+
32
43
  it "overwrites styles" do
33
44
  map.add(:reverse, 0, 0..1)
34
45
  map.add(:normal, 0, 0..1)
@@ -92,7 +103,7 @@ describe Ruco::StyleMap do
92
103
  s.invert!
93
104
  s.flatten.should == [
94
105
  [:normal, nil, :normal],
95
- [nil, :reverse, nil, nil, :red, nil, :normal]
106
+ [nil, :reverse, nil, :normal, :red, nil, :normal]
96
107
  ]
97
108
  end
98
109
  end
@@ -0,0 +1,74 @@
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
@@ -0,0 +1,14 @@
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
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1,12 @@
1
1
  $LOAD_PATH.unshift 'lib'
2
+ $ruco_colors = true
3
+
2
4
  require 'ruco'
3
5
  require 'timeout'
4
-
5
6
  require 'tempfile'
7
+
8
+ silence_warnings{ Ruco::Editor::Colors::DEFAULT_THEME = 'spec/fixtures/test.tmTheme' }
9
+
6
10
  class Tempfile
7
11
  def self.string_as_file(data)
8
12
  result = nil
@@ -21,4 +25,4 @@ class Time
21
25
  yield
22
26
  Time.now.to_f - t
23
27
  end
24
- end
28
+ end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruco
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
4
+ hash: 31098193
5
+ prerelease: 6
6
6
  segments:
7
7
  - 0
8
- - 1
9
- - 14
10
- version: 0.1.14
8
+ - 2
9
+ - 0
10
+ - beta
11
+ version: 0.2.0.beta
11
12
  platform: ruby
12
13
  authors:
13
14
  - Michael Grosser
@@ -15,11 +16,11 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2011-09-02 00:00:00 +02:00
19
+ date: 2011-09-23 00:00:00 +02:00
19
20
  default_executable: ruco
20
21
  dependencies:
21
22
  - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
24
  none: false
24
25
  requirements:
25
26
  - - ">="
@@ -30,9 +31,37 @@ dependencies:
30
31
  - 9
31
32
  - 8
32
33
  version: 0.9.8
34
+ requirement: *id001
33
35
  type: :runtime
34
36
  name: clipboard
35
- version_requirements: *id001
37
+ prerelease: false
38
+ - !ruby/object:Gem::Dependency
39
+ version_requirements: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ hash: 3
45
+ segments:
46
+ - 0
47
+ version: "0"
48
+ requirement: *id002
49
+ type: :runtime
50
+ name: ultraviolet1x
51
+ prerelease: false
52
+ - !ruby/object:Gem::Dependency
53
+ version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ hash: 3
59
+ segments:
60
+ - 0
61
+ version: "0"
62
+ requirement: *id003
63
+ type: :runtime
64
+ name: language_sniffer
36
65
  prerelease: false
37
66
  description:
38
67
  email: michael@grosser.it
@@ -51,6 +80,7 @@ files:
51
80
  - bin/ruco
52
81
  - lib/ruco.rb
53
82
  - lib/ruco/application.rb
83
+ - lib/ruco/array_processor.rb
54
84
  - lib/ruco/command_bar.rb
55
85
  - lib/ruco/core_ext/array.rb
56
86
  - lib/ruco/core_ext/file.rb
@@ -59,6 +89,7 @@ files:
59
89
  - lib/ruco/core_ext/range.rb
60
90
  - lib/ruco/core_ext/string.rb
61
91
  - lib/ruco/editor.rb
92
+ - lib/ruco/editor/colors.rb
62
93
  - lib/ruco/editor/history.rb
63
94
  - lib/ruco/editor/line_numbers.rb
64
95
  - lib/ruco/editor_area.rb
@@ -71,14 +102,22 @@ files:
71
102
  - lib/ruco/screen.rb
72
103
  - lib/ruco/status_bar.rb
73
104
  - lib/ruco/style_map.rb
105
+ - lib/ruco/syntax_parser.rb
74
106
  - lib/ruco/text_area.rb
75
107
  - lib/ruco/text_field.rb
108
+ - lib/ruco/tm_theme.rb
76
109
  - lib/ruco/version.rb
77
110
  - lib/ruco/window.rb
111
+ - playground/benchmark_syntax_parser.rb
78
112
  - ruco.gemspec
113
+ - spec/fixtures/railscasts.tmTheme
114
+ - spec/fixtures/slow.js
115
+ - spec/fixtures/test.tmTheme
79
116
  - spec/ruco/application_spec.rb
117
+ - spec/ruco/array_processor_spec.rb
80
118
  - spec/ruco/command_bar_spec.rb
81
119
  - spec/ruco/core_ext/array_spec.rb
120
+ - spec/ruco/core_ext/range_spec.rb
82
121
  - spec/ruco/core_ext/string_spec.rb
83
122
  - spec/ruco/editor_spec.rb
84
123
  - spec/ruco/file_store_spec.rb
@@ -89,7 +128,9 @@ files:
89
128
  - spec/ruco/screen_spec.rb
90
129
  - spec/ruco/status_bar_spec.rb
91
130
  - spec/ruco/style_map_spec.rb
131
+ - spec/ruco/syntax_parser_spec.rb
92
132
  - spec/ruco/text_area_spec.rb
133
+ - spec/ruco/tm_theme_spec.rb
93
134
  - spec/ruco/window_spec.rb
94
135
  - spec/ruco_spec.rb
95
136
  - spec/spec_helper.rb
@@ -118,12 +159,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
159
  required_rubygems_version: !ruby/object:Gem::Requirement
119
160
  none: false
120
161
  requirements:
121
- - - ">="
162
+ - - ">"
122
163
  - !ruby/object:Gem::Version
123
- hash: 3
164
+ hash: 25
124
165
  segments:
125
- - 0
126
- version: "0"
166
+ - 1
167
+ - 3
168
+ - 1
169
+ version: 1.3.1
127
170
  requirements: []
128
171
 
129
172
  rubyforge_project:
@@ -131,21 +174,5 @@ rubygems_version: 1.6.2
131
174
  signing_key:
132
175
  specification_version: 3
133
176
  summary: Commandline editor written in ruby
134
- test_files:
135
- - spec/ruco/application_spec.rb
136
- - spec/ruco/command_bar_spec.rb
137
- - spec/ruco/core_ext/array_spec.rb
138
- - spec/ruco/core_ext/string_spec.rb
139
- - spec/ruco/editor_spec.rb
140
- - spec/ruco/file_store_spec.rb
141
- - spec/ruco/form_spec.rb
142
- - spec/ruco/history_spec.rb
143
- - spec/ruco/keyboard_spec.rb
144
- - spec/ruco/option_accessor_spec.rb
145
- - spec/ruco/screen_spec.rb
146
- - spec/ruco/status_bar_spec.rb
147
- - spec/ruco/style_map_spec.rb
148
- - spec/ruco/text_area_spec.rb
149
- - spec/ruco/window_spec.rb
150
- - spec/ruco_spec.rb
151
- - spec/spec_helper.rb
177
+ test_files: []
178
+