tickly 2.1.0 → 2.1.2

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.
@@ -0,0 +1,21 @@
1
+ require 'helper'
2
+ require 'benchmark'
3
+
4
+ class TestParserEvaluator < Test::Unit::TestCase
5
+
6
+ class Tracker3
7
+ def initialize(n); end
8
+ end
9
+
10
+ def test_parses_huge
11
+ pe = Tickly::NodeProcessor.new
12
+ pe.add_node_handler_class(Tracker3)
13
+
14
+ Benchmark.bm do | runner |
15
+ runner.report("Parsing a huge Nuke script:") do
16
+ counter = 0
17
+ pe.parse(HUGE_SCRIPT) { counter += 1 }
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,20 @@
1
+ require "helper"
2
+
3
+ class TestEmitter < Test::Unit::TestCase
4
+ def test_emitter_e
5
+ assert_equal ["2", "2"], e("2", "2")
6
+ end
7
+
8
+ def test_emitter_le
9
+ assert_equal [:c, "2", "2"], le("2", "2")
10
+ end
11
+
12
+ def test_emitter_be
13
+ assert_equal [:b, "2", "2"], se("2", "2")
14
+ end
15
+
16
+ def test_emitter_be
17
+ assert_equal [:b, [:c,"2", "2"]], se(le("2", "2"))
18
+ end
19
+
20
+ end
@@ -1,9 +1,8 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestEvaluator < Test::Unit::TestCase
4
- include Tickly::Emitter
5
4
 
6
- should "not do anything without handlers" do
5
+ def test_does_nothing_without_handlers
7
6
  stack = le("Tracker4", le(le("enabled", "true")))
8
7
  e = Tickly::Evaluator.new
9
8
  e.evaluate(stack)
@@ -1,8 +1,8 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestParserEvaluator < Test::Unit::TestCase
4
- include Tickly::Emitter
5
4
 
5
+ HUGE_SCRIPT = File.open(File.dirname(__FILE__) + "/test-data/huge_nuke_tcl.tcl")
6
6
  NUKE7_SCRIPT = File.open(File.dirname(__FILE__) + "/test-data/nuke7_tracker_2tracks.nk")
7
7
 
8
8
  class Tracker4
@@ -33,4 +33,5 @@ class TestParserEvaluator < Test::Unit::TestCase
33
33
  pe = Tickly::NodeProcessor.new
34
34
  assert_raise(LocalJumpError) { pe.parse(NUKE7_SCRIPT) }
35
35
  end
36
+
36
37
  end
data/test/test_parser.rb CHANGED
@@ -1,23 +1,22 @@
1
- require 'helper'
1
+ require File.dirname(__FILE__) + '/helper'
2
2
 
3
3
  class TestParser < Test::Unit::TestCase
4
4
  P = Tickly::Parser.new
5
- include Tickly::Emitter
6
5
 
7
- should "parse a single int as a stack with a string" do
6
+ def test_parse_single_int_as_a_stack_with_string_token
8
7
  assert_equal e(e("2")), P.parse('2')
9
8
  end
10
9
 
11
- should "parse a single int and discard whitespace" do
10
+ def test_parse_single_int_and_discard_whitespace
12
11
  p = P.parse(' 2 ')
13
12
  assert_equal e(e("2")), p
14
13
  end
15
14
 
16
- should "parse multiple ints and strings as a stack of subexpressions" do
15
+ def test_parse_multiple_ints_and_strings_as_stack_of_expressions
17
16
  assert_equal e(e("2", "foo", "bar", "baz")), P.parse('2 foo bar baz')
18
17
  end
19
18
 
20
- should "parse and expand a string in double quotes" do
19
+ def test_parse_and_expand_a_string_in_double_quotes
21
20
  p = P.parse('"This is a string literal with spaces"')
22
21
  assert_equal e(e("This is a string literal with spaces")), p
23
22
 
@@ -25,11 +24,11 @@ class TestParser < Test::Unit::TestCase
25
24
  assert_equal e(e("This is a string literal \"escaped\" with spaces")), p
26
25
  end
27
26
 
28
- should "parse a string expression" do
27
+ def test_parse_string_expression
29
28
  assert_equal e(e(se("1", "2", "3"))), P.parse("[1 2 3]")
30
29
  end
31
30
 
32
- should "parse multiple string expressions" do
31
+ def test_parse_multiple_string_expressions_in_one_expression
33
32
  p = P.parse("[1 2 3] [3 4 5 foo]")
34
33
  assert_equal e(e(se("1", "2", "3"), se("3", "4", "5", "foo"))), p
35
34
  end
@@ -45,6 +44,25 @@ class TestParser < Test::Unit::TestCase
45
44
  assert_equal e(e(le("4", "+", "5"))), p
46
45
  end
47
46
 
47
+ def test_raises_on_unterminated_string
48
+ expr = '"Literal with no closing quote'
49
+ assert_raise(Tickly::Parser::Error) { P.parse(expr) }
50
+ end
51
+
52
+ def test_raises_on_unterminated_subexpressions
53
+ expr = 'a {b'
54
+ assert_raise(Tickly::Parser::Error) { P.parse(expr) }
55
+
56
+ expr = 'a [b'
57
+ assert_raise(Tickly::Parser::Error) { P.parse(expr) }
58
+ end
59
+
60
+ def test_curlies_after_expr
61
+ expr = 'a{4 + 5}b'
62
+ p = P.parse(expr)
63
+ assert_equal [["a", [:c, "4", "+", "5"], "b"]], p
64
+ end
65
+
48
66
  def test_parsing_a_nuke_node
49
67
  f = File.open(File.dirname(__FILE__) + "/test-data/nukenode.txt")
50
68
  p = P.parse(f)
@@ -70,7 +88,7 @@ class TestParser < Test::Unit::TestCase
70
88
  assert_equal script, p
71
89
  end
72
90
 
73
- should 'parse a simple Nuke script and internalize the RotoPaint in it' do
91
+ def test_parse_a_simple_Nuke_script_and_internalize_the_RotoPaint
74
92
  f = File.open(File.dirname(__FILE__) + "/test-data/three_nodes_and_roto.txt")
75
93
  p = P.parse(f)
76
94
  # Should pass through the rotopaint node and get to the blur properly
@@ -115,6 +133,13 @@ class TestParser < Test::Unit::TestCase
115
133
  assert_equal [], p
116
134
  end
117
135
 
136
+ def test_parsing_nuke_script_with_shitdows_line_breaks
137
+ f = File.open(File.dirname(__FILE__) + "/test-data/windows_linebreaks.nk")
138
+ p = P.parse(f)
139
+
140
+ first_expr = p[0]
141
+ assert_equal ["set", "cut_paste_input", [:b, "stack", "0"]], first_expr, "Should have chopped off the <CR>"
142
+ end
118
143
 
119
144
  def test_parsing_nuke_script_with_indentations
120
145
  f = File.open(File.dirname(__FILE__) + "/test-data/nuke_group.txt")
data/tickly.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "tickly"
8
- s.version = "2.1.0"
8
+ s.version = "2.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik Tarkhanov"]
12
- s.date = "2013-03-23"
12
+ s.date = "2013-08-15"
13
13
  s.description = "Parses the subset of the TCL grammar needed for Nuke scripts"
14
14
  s.email = "me@julik.nl"
15
15
  s.extra_rdoc_files = [
@@ -39,7 +39,10 @@ Gem::Specification.new do |s|
39
39
  "test/test-data/three_nodes_and_roto.txt",
40
40
  "test/test-data/tracker_with_differing_gaps.nk",
41
41
  "test/test-data/tracker_with_repeating_gaps.nk",
42
+ "test/test-data/windows_linebreaks.nk",
43
+ "test/test_benchmark.rb",
42
44
  "test/test_curve.rb",
45
+ "test/test_emitter.rb",
43
46
  "test/test_evaluator.rb",
44
47
  "test/test_node_processor.rb",
45
48
  "test/test_parser.rb",
@@ -48,7 +51,7 @@ Gem::Specification.new do |s|
48
51
  s.homepage = "http://github.com/julik/tickly"
49
52
  s.licenses = ["MIT"]
50
53
  s.require_paths = ["lib"]
51
- s.rubygems_version = "1.8.24"
54
+ s.rubygems_version = "1.8.25"
52
55
  s.summary = "Assists in parsing Nuke scripts in TCL"
53
56
 
54
57
  if s.respond_to? :specification_version then
@@ -57,14 +60,12 @@ Gem::Specification.new do |s|
57
60
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
58
61
  s.add_runtime_dependency(%q<bychar>, ["~> 2"])
59
62
  s.add_development_dependency(%q<rake>, [">= 0"])
60
- s.add_development_dependency(%q<shoulda>, [">= 0"])
61
63
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
62
64
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
63
65
  s.add_development_dependency(%q<ruby-prof>, [">= 0"])
64
66
  else
65
67
  s.add_dependency(%q<bychar>, ["~> 2"])
66
68
  s.add_dependency(%q<rake>, [">= 0"])
67
- s.add_dependency(%q<shoulda>, [">= 0"])
68
69
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
69
70
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
70
71
  s.add_dependency(%q<ruby-prof>, [">= 0"])
@@ -72,7 +73,6 @@ Gem::Specification.new do |s|
72
73
  else
73
74
  s.add_dependency(%q<bychar>, ["~> 2"])
74
75
  s.add_dependency(%q<rake>, [">= 0"])
75
- s.add_dependency(%q<shoulda>, [">= 0"])
76
76
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
77
77
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
78
78
  s.add_dependency(%q<ruby-prof>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tickly
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-23 00:00:00.000000000 Z
12
+ date: 2013-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bychar
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: shoulda
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: rdoc
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -137,7 +121,10 @@ files:
137
121
  - test/test-data/three_nodes_and_roto.txt
138
122
  - test/test-data/tracker_with_differing_gaps.nk
139
123
  - test/test-data/tracker_with_repeating_gaps.nk
124
+ - test/test-data/windows_linebreaks.nk
125
+ - test/test_benchmark.rb
140
126
  - test/test_curve.rb
127
+ - test/test_emitter.rb
141
128
  - test/test_evaluator.rb
142
129
  - test/test_node_processor.rb
143
130
  - test/test_parser.rb
@@ -157,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
144
  version: '0'
158
145
  segments:
159
146
  - 0
160
- hash: -720429447261605785
147
+ hash: 1232326070308292090
161
148
  required_rubygems_version: !ruby/object:Gem::Requirement
162
149
  none: false
163
150
  requirements:
@@ -166,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
153
  version: '0'
167
154
  requirements: []
168
155
  rubyforge_project:
169
- rubygems_version: 1.8.24
156
+ rubygems_version: 1.8.25
170
157
  signing_key:
171
158
  specification_version: 3
172
159
  summary: Assists in parsing Nuke scripts in TCL