piggly 1.2.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +163 -0
  3. data/Rakefile +29 -15
  4. data/bin/piggly +4 -244
  5. data/lib/piggly.rb +19 -17
  6. data/lib/piggly/command.rb +9 -0
  7. data/lib/piggly/command/base.rb +148 -0
  8. data/lib/piggly/command/report.rb +162 -0
  9. data/lib/piggly/command/test.rb +157 -0
  10. data/lib/piggly/command/trace.rb +90 -0
  11. data/lib/piggly/command/untrace.rb +78 -0
  12. data/lib/piggly/compiler.rb +7 -5
  13. data/lib/piggly/compiler/cache_dir.rb +119 -0
  14. data/lib/piggly/compiler/coverage_report.rb +63 -0
  15. data/lib/piggly/compiler/trace_compiler.rb +105 -0
  16. data/lib/piggly/config.rb +47 -22
  17. data/lib/piggly/dumper.rb +9 -0
  18. data/lib/piggly/dumper/index.rb +121 -0
  19. data/lib/piggly/dumper/qualified_name.rb +36 -0
  20. data/lib/piggly/dumper/qualified_type.rb +81 -0
  21. data/lib/piggly/dumper/reified_procedure.rb +142 -0
  22. data/lib/piggly/dumper/skeleton_procedure.rb +102 -0
  23. data/lib/piggly/installer.rb +84 -42
  24. data/lib/piggly/parser.rb +43 -49
  25. data/lib/piggly/parser/grammar.tt +289 -313
  26. data/lib/piggly/parser/nodes.rb +270 -211
  27. data/lib/piggly/parser/traversal.rb +35 -33
  28. data/lib/piggly/parser/treetop_ruby19_patch.rb +1 -1
  29. data/lib/piggly/profile.rb +81 -60
  30. data/lib/piggly/reporter.rb +5 -18
  31. data/lib/piggly/reporter/base.rb +103 -0
  32. data/lib/piggly/reporter/html_dsl.rb +63 -0
  33. data/lib/piggly/reporter/index.rb +108 -0
  34. data/lib/piggly/reporter/procedure.rb +104 -0
  35. data/lib/piggly/reporter/resources/highlight.js +21 -0
  36. data/lib/piggly/reporter/{piggly.css → resources/piggly.css} +52 -12
  37. data/lib/piggly/reporter/{sortable.js → resources/sortable.js} +0 -0
  38. data/lib/piggly/tags.rb +280 -0
  39. data/lib/piggly/task.rb +191 -40
  40. data/lib/piggly/util.rb +8 -27
  41. data/lib/piggly/util/blankslate.rb +114 -0
  42. data/lib/piggly/util/cacheable.rb +19 -0
  43. data/lib/piggly/util/enumerable.rb +44 -0
  44. data/lib/piggly/util/file.rb +17 -0
  45. data/lib/piggly/util/process_queue.rb +96 -0
  46. data/lib/piggly/util/thunk.rb +39 -0
  47. data/lib/piggly/version.rb +8 -8
  48. data/spec/examples/compiler/cacheable_spec.rb +190 -0
  49. data/spec/examples/compiler/report_spec.rb +25 -0
  50. data/spec/{compiler → examples/compiler}/trace_spec.rb +7 -57
  51. data/spec/examples/config_spec.rb +61 -0
  52. data/spec/examples/dumper/index_spec.rb +197 -0
  53. data/spec/examples/dumper/procedure_spec.rb +116 -0
  54. data/spec/{grammar → examples/grammar}/expression_spec.rb +60 -60
  55. data/spec/{grammar → examples/grammar}/statements/assignment_spec.rb +15 -15
  56. data/spec/examples/grammar/statements/declaration_spec.rb +21 -0
  57. data/spec/{grammar → examples/grammar}/statements/exception_spec.rb +10 -10
  58. data/spec/{grammar → examples/grammar}/statements/if_spec.rb +47 -34
  59. data/spec/{grammar → examples/grammar}/statements/loop_spec.rb +5 -5
  60. data/spec/{grammar → examples/grammar}/statements/sql_spec.rb +11 -11
  61. data/spec/{grammar → examples/grammar}/tokens/comment_spec.rb +11 -11
  62. data/spec/{grammar → examples/grammar}/tokens/datatype_spec.rb +14 -8
  63. data/spec/{grammar → examples/grammar}/tokens/identifier_spec.rb +26 -10
  64. data/spec/{grammar → examples/grammar}/tokens/keyword_spec.rb +5 -5
  65. data/spec/{grammar → examples/grammar}/tokens/label_spec.rb +7 -7
  66. data/spec/{grammar → examples/grammar}/tokens/literal_spec.rb +1 -1
  67. data/spec/examples/grammar/tokens/lval_spec.rb +50 -0
  68. data/spec/{grammar → examples/grammar}/tokens/number_spec.rb +1 -1
  69. data/spec/{grammar → examples/grammar}/tokens/sqlkeywords_spec.rb +1 -1
  70. data/spec/{grammar → examples/grammar}/tokens/string_spec.rb +9 -9
  71. data/spec/{grammar → examples/grammar}/tokens/whitespace_spec.rb +1 -1
  72. data/spec/examples/installer_spec.rb +59 -0
  73. data/spec/examples/parser/nodes_spec.rb +73 -0
  74. data/spec/examples/parser/traversal_spec.rb +14 -0
  75. data/spec/examples/parser_spec.rb +115 -0
  76. data/spec/examples/profile_spec.rb +153 -0
  77. data/spec/{reporter/html_spec.rb → examples/reporter/html/dsl_spec.rb} +0 -0
  78. data/spec/examples/reporter/html/index_spec.rb +0 -0
  79. data/spec/examples/reporter/html_spec.rb +1 -0
  80. data/spec/examples/reporter_spec.rb +0 -0
  81. data/spec/{compiler → examples}/tags_spec.rb +10 -10
  82. data/spec/examples/task_spec.rb +0 -0
  83. data/spec/examples/util/cacheable_spec.rb +41 -0
  84. data/spec/examples/util/enumerable_spec.rb +64 -0
  85. data/spec/examples/util/file_spec.rb +40 -0
  86. data/spec/examples/util/process_queue_spec.rb +16 -0
  87. data/spec/examples/util/thunk_spec.rb +58 -0
  88. data/spec/examples/version_spec.rb +0 -0
  89. data/spec/issues/007_spec.rb +25 -0
  90. data/spec/issues/008_spec.rb +73 -0
  91. data/spec/issues/018_spec.rb +25 -0
  92. data/spec/spec_helper.rb +253 -9
  93. metadata +136 -93
  94. data/README.markdown +0 -116
  95. data/lib/piggly/compiler/cache.rb +0 -151
  96. data/lib/piggly/compiler/pretty.rb +0 -67
  97. data/lib/piggly/compiler/queue.rb +0 -46
  98. data/lib/piggly/compiler/tags.rb +0 -244
  99. data/lib/piggly/compiler/trace.rb +0 -91
  100. data/lib/piggly/filecache.rb +0 -40
  101. data/lib/piggly/parser/parser.rb +0 -11794
  102. data/lib/piggly/reporter/html.rb +0 -207
  103. data/spec/compiler/cache_spec.rb +0 -9
  104. data/spec/compiler/pretty_spec.rb +0 -9
  105. data/spec/compiler/queue_spec.rb +0 -3
  106. data/spec/compiler/rewrite_spec.rb +0 -3
  107. data/spec/config_spec.rb +0 -58
  108. data/spec/filecache_spec.rb +0 -70
  109. data/spec/fixtures/snippets.sql +0 -158
  110. data/spec/grammar/tokens/lval_spec.rb +0 -50
  111. data/spec/parser_spec.rb +0 -8
  112. data/spec/profile_spec.rb +0 -5
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -7,43 +7,49 @@ module Piggly
7
7
  describe "data types" do
8
8
  it "can consist of a single word" do
9
9
  %w[int boolean char varchar text date timestamp record].test_each do |s|
10
- parse(:tType, s).should be_a(TDatatype)
10
+ parse(:tType, s).should be_datatype
11
11
  end
12
12
  end
13
13
 
14
14
  it "can have parameterized types" do
15
15
  ["numeric(10,2)", "decimal(12,4)", "char(1)", "varchar(100)"].test_each do |s|
16
- parse(:tType, s).should be_a(TDatatype)
16
+ parse(:tType, s).should be_datatype
17
17
  end
18
18
  end
19
19
 
20
20
  it "can end in %ROWTYPE" do
21
21
  %w[users%rowtype].test_each do |s|
22
- parse(:tType, s).should be_a(TDatatype)
22
+ parse(:tType, s).should be_datatype
23
+ end
24
+ end
25
+
26
+ it "can have namespace notation" do
27
+ %w[public.users namespace.relation%rowtype].test_each do |s|
28
+ parse(:tType, s).should be_datatype
23
29
  end
24
30
  end
25
31
 
26
32
  it "can consist of several words" do
27
33
  ["timestamp with time zone", "character varying"].test_each do |s|
28
- parse(:tType, s).should be_a(TDatatype)
34
+ parse(:tType, s).should be_datatype
29
35
  end
30
36
  end
31
37
 
32
38
  it "can specify arrays" do
33
39
  ["integer[]", "varchar(10)[]", "numeric(10,2)[]", "timestamp without time zone[]"].test_each do |s|
34
- parse(:tType, s).should be_a(TDatatype)
40
+ parse(:tType, s).should be_datatype
35
41
  end
36
42
  end
37
43
 
38
44
  it "can specify multi-dimensional" do
39
45
  ["integer[][]", "char(1)[][]", "character varying[][]"].test_each do |s|
40
- parse(:tType, s).should be_a(TDatatype)
46
+ parse(:tType, s).should be_datatype
41
47
  end
42
48
  end
43
49
 
44
50
  it "are terminated by symbol outside of parentheses" do
45
51
  node, rest = parse_some(:tType, "character varying, ")
46
- node.should be_a(TDatatype)
52
+ node.should be_datatype
47
53
  rest.should == ', '
48
54
  end
49
55
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -7,50 +7,66 @@ module Piggly
7
7
  describe "identifiers" do
8
8
  it "cannot be a keyword" do
9
9
  GrammarHelper::KEYWORDS.test_each do |s|
10
- lambda{ parse(:tIdentifier, s) }.should raise_error
10
+ lambda{ parse(:tIdentifier, s); puts s }.should raise_error
11
11
  end
12
12
  end
13
13
 
14
14
  it "can be quoted keyword" do
15
15
  GrammarHelper::KEYWORDS.map{|s| '"' + s + '"' }.test_each do |s|
16
- parse(:tIdentifier, s).should be_a(TIdentifier)
16
+ parse(:tIdentifier, s).should be_identifier
17
17
  end
18
18
  end
19
19
 
20
20
  it "can begin with a keyword" do
21
21
  GrammarHelper::KEYWORDS.select{|s| s =~ /^[a-z]/i }.map{|s| "#{s}xyz" }.test_each do |s|
22
- parse(:tIdentifier, s).should be_a(TIdentifier)
22
+ parse(:tIdentifier, s).should be_identifier
23
23
  end
24
24
 
25
25
  GrammarHelper::KEYWORDS.select{|s| s =~ /^[a-z]/i }.map{|s| "#{s}_xyz" }.test_each do |s|
26
- parse(:tIdentifier, s).should be_a(TIdentifier)
26
+ parse(:tIdentifier, s).should be_identifier
27
27
  end
28
28
  end
29
29
 
30
30
  it "can end with a keyword" do
31
31
  GrammarHelper::KEYWORDS.select{|s| s =~ /^[a-z]/i }.map{|s| "xyz#{s}" }.test_each do |s|
32
- parse(:tIdentifier, s).should be_a(TIdentifier)
32
+ parse(:tIdentifier, s).should be_identifier
33
33
  end
34
34
 
35
35
  GrammarHelper::KEYWORDS.select{|s| s =~ /^[a-z]/i }.map{|s| "xyz_#{s}" }.test_each do |s|
36
- parse(:tIdentifier, s).should be_a(TIdentifier)
36
+ parse(:tIdentifier, s).should be_identifier
37
+ end
38
+ end
39
+
40
+ it "is terminated by an operator" do
41
+ GrammarHelper::KEYWORDS.select{|s| s !~ /^[a-z]/i }.test_each do |op|
42
+ node, rest = parse_some(:tIdentifier, "xyv#{op}")
43
+ node.should be_identifier
44
+ rest.should == op
45
+ end
46
+ end
47
+
48
+ it "is terminated by an operator" do
49
+ GrammarHelper::KEYWORDS.select{|s| s !~ /^[a-z]/i }.test_each do |op|
50
+ node, rest = parse_some(:tIdentifier, "xyv_#{op}")
51
+ node.should be_identifier
52
+ rest.should == op
37
53
  end
38
54
  end
39
55
 
40
56
  it "can be one single character" do
41
57
  %w[_ a b c d e f g h i j k l m n o p q r s t u v w x y z].test_each do |s|
42
- parse(:tIdentifier, s).should be_a(TIdentifier)
58
+ parse(:tIdentifier, s).should be_identifier
43
59
  end
44
60
  end
45
61
 
46
62
  it "can contain underscores" do
47
63
  %w[_abc abc_ ab_c a_bc ab_cd ab_c_d a_bc_d ab_c_d a_b_c_d a__b__c__d].test_each do |s|
48
- parse(:tIdentifier, s).should be_a(TIdentifier)
64
+ parse(:tIdentifier, s).should be_identifier
49
65
  end
50
66
  end
51
67
 
52
68
  it "can contain numbers" do
53
- parse(:tIdentifier, 'foo9000').should be_a(TIdentifier)
69
+ parse(:tIdentifier, 'foo9000').should be_identifier
54
70
  end
55
71
  end
56
72
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -7,7 +7,7 @@ module Piggly
7
7
  describe "keywords" do
8
8
  it "parse successfully" do
9
9
  GrammarHelper::KEYWORDS.test_each do |k|
10
- parse(:keyword, k).should be_a(TKeyword)
10
+ parse(:keyword, k).should be_keyword
11
11
  end
12
12
  end
13
13
 
@@ -26,7 +26,7 @@ module Piggly
26
26
  it "are terminated by symbols" do
27
27
  GrammarHelper::KEYWORDS.test_each do |k|
28
28
  node, rest = parse_some(:keyword, "#{k}+")
29
- node.should be_a(TKeyword)
29
+ node.should be_keyword
30
30
  rest.should == '+'
31
31
  end
32
32
  end
@@ -34,11 +34,11 @@ module Piggly
34
34
  it "are terminated by spaces" do
35
35
  GrammarHelper::KEYWORDS.test_each do |k|
36
36
  node, rest = parse_some(:keyword, "#{k} ")
37
- node.should be_a(TKeyword)
37
+ node.should be_keyword
38
38
  rest.should == ' '
39
39
  end
40
40
  end
41
41
  end
42
42
 
43
43
  end
44
- end
44
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -7,34 +7,34 @@ module Piggly
7
7
  describe "labels" do
8
8
  it "must be enclosed in << and >>" do
9
9
  ['', 'a', 'abc', '<< a', 'a >>'].test_each do |s|
10
- lambda{ parse(:tLabel, s) }.should raise_error
10
+ lambda{ parse(:tLabelDefinition, s) }.should raise_error
11
11
  end
12
12
  end
13
13
 
14
14
  it "can have space padding" do
15
15
  %w[a abc _].map{|s| "<< #{s} >>" }.test_each do |s|
16
- parse(:tLabel, s).should be_a(TLabel)
16
+ parse(:tLabelDefinition, s).should be_label
17
17
  end
18
18
  end
19
19
 
20
20
  it "can have no space padding" do
21
21
  %w[a abc _].map{|s| "<<#{s}>>" }.test_each do |s|
22
- parse(:tLabel, s).should be_a(TLabel)
22
+ parse(:tLabelDefinition, s).should be_label
23
23
  end
24
24
  end
25
25
 
26
26
  it "cannot be multiple unquoted words" do
27
27
  ["<< a b >>", "<< ab cd >>"].test_each do |s|
28
- lambda{ parse(:tLabel, s) }.should raise_error
28
+ lambda{ parse(:tLabelDefinition, s) }.should raise_error
29
29
  end
30
30
  end
31
31
 
32
32
  it "can be enclosed in double quotes" do
33
33
  ['<< "a" >>', '<< "a b" >>', '<< "ab cd" >>'].test_each do |s|
34
- parse(:tLabel, s).should be_a(TLabel)
34
+ parse(:tLabelDefinition, s).should be_label
35
35
  end
36
36
  end
37
37
  end
38
38
 
39
39
  end
40
- end
40
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ module Piggly
4
+ describe Parser, "tokens" do
5
+ include GrammarHelper
6
+
7
+ describe "l-values" do
8
+ it "can be a simple identifier" do
9
+ parse(:lValue, 'id').should be_a(Parser::Nodes::Assignable)
10
+ end
11
+
12
+ it "can be an attribute accessor" do
13
+ parse(:lValue, 'record.id').should be_a(Parser::Nodes::Assignable)
14
+ parse(:lValue, 'public.dataset.id').should be_a(Parser::Nodes::Assignable)
15
+ end
16
+
17
+ it "can use quoted attributes" do
18
+ parse(:lValue, 'record."ID"').should be_a(Parser::Nodes::Assignable)
19
+ parse(:lValue, '"schema name"."table name"."column name"').should be_a(Parser::Nodes::Assignable)
20
+ end
21
+
22
+ it "can be an array accessor" do
23
+ parse(:lValue, 'names[0]').should be_a(Parser::Nodes::Assignable)
24
+ parse(:lValue, 'names[1000]').should be_a(Parser::Nodes::Assignable)
25
+ end
26
+
27
+ it "can contain comments in array accessors" do
28
+ node = parse(:lValue, 'names[3 /* comment */]')
29
+ node.should be_a(Parser::Nodes::Assignable)
30
+ node.count{|e| e.comment? }.should == 1
31
+
32
+ node = parse(:lValue, "names[9 -- comment \n]")
33
+ node.should be_a(Parser::Nodes::Assignable)
34
+ node.count{|e| e.comment? }.should == 1
35
+ end
36
+
37
+ it "can be an array accessed by another l-value" do
38
+ parse(:lValue, 'names[face.id]').should be_a(Parser::Nodes::Assignable)
39
+ end
40
+
41
+ it "can be a nested array access"
42
+ # names[faces[0].id].id doesn't work because it requires context-sensitivity [faces[0]
43
+
44
+ it "can be a multi-dimensional array access" do
45
+ parse(:lValue, 'data[10][2][0]').should be_a(Parser::Nodes::Assignable)
46
+ end
47
+ end
48
+
49
+ end
50
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
 
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -7,29 +7,29 @@ module Piggly
7
7
  describe "strings" do
8
8
  it "can be enclosed within single quotes" do
9
9
  ["''", "'abc'", "'abc xyz'"].test_each do |s|
10
- parse(:tString, s).should be_a(TString)
10
+ parse(:tString, s).should be_string
11
11
  end
12
12
  end
13
13
 
14
14
  it "cannot be nested within single quotes" do
15
15
  node, rest = parse_some(:tString, "'abc 'xyz' tuv'")
16
- node.should be_a(TString)
16
+ node.should be_string
17
17
  rest.should == "xyz' tuv'"
18
18
 
19
19
  node, rest = parse_some(:tString, "'can't'")
20
- node.should be_a(TString)
20
+ node.should be_string
21
21
  rest.should == "t'"
22
22
  end
23
23
 
24
24
  it "can contain escaped single quotes" do
25
25
  ["''''", "'can''t'", "'abc '' xyz'"].test_each do |s|
26
- parse(:tString, s).should be_a(TString)
26
+ parse(:tString, s).should be_string
27
27
  end
28
28
  end
29
29
 
30
30
  it "can be enclosed with $$ tags" do
31
31
  ["$$$$", "$$ abc $$", "$T$ abc $T$", "$tt$ abc $tt$"].test_each do |s|
32
- parse(:tString, s).should be_a(TString)
32
+ parse(:tString, s).should be_string
33
33
  end
34
34
  end
35
35
 
@@ -39,16 +39,16 @@ module Piggly
39
39
 
40
40
  it "can embed $$ strings within single-quoted strings" do
41
41
  ["'ab $$ xyz $$ cd'", "'a $b$ c $b$ d'"].test_each do |s|
42
- parse(:tString, s).should be_a(TString)
42
+ parse(:tString, s).should be_string
43
43
  end
44
44
  end
45
45
 
46
46
  it "can embed single-quote strings within $$ strings" do
47
47
  ["$$ 'abc' $$", "$ABC$ 'ab''cd' $ABC$"].test_each do |s|
48
- parse(:tString, s).should be_a(TString)
48
+ parse(:tString, s).should be_string
49
49
  end
50
50
  end
51
51
  end
52
52
 
53
53
  end
54
- end
54
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'spec_helper'))
1
+ require 'spec_helper'
2
2
 
3
3
  module Piggly
4
4
  describe Parser, "tokens" do
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ module Piggly
4
+
5
+ describe Installer do
6
+
7
+ before do
8
+ @config = Config.new
9
+ @connection = mock('connection')
10
+ @installer = Installer.new(@config, @connection)
11
+ end
12
+
13
+ describe "trace" do
14
+ it "compiles, executes, and profiles the procedure" do
15
+ untraced = 'create or replace function x(char)'
16
+ traced = 'create or replace function f(int)'
17
+
18
+ result = {:tags => stub, :code => traced}
19
+ profile = mock('profile')
20
+
21
+ compiler = mock('compiler', :compile => result)
22
+ Compiler::TraceCompiler.should_receive(:new).
23
+ and_return(compiler)
24
+
25
+ procedure = mock('procedure', :oid => 'oid', :source => untraced)
26
+ procedure.should_receive(:definition).
27
+ with(traced).and_return(traced)
28
+
29
+ @connection.should_receive(:exec).
30
+ with(traced)
31
+
32
+ profile.should_receive(:add).
33
+ with(procedure, result[:tags], result)
34
+
35
+ @installer.trace(procedure, profile)
36
+ end
37
+ end
38
+
39
+ describe "untrace" do
40
+ it "executes the original definition" do
41
+ untraced = 'create or replace function x(char)'
42
+ procedure = stub(:oid => 'oid', :source => untraced)
43
+
44
+ procedure.should_receive(:definition).
45
+ and_return(untraced)
46
+
47
+ @connection.should_receive(:exec).
48
+ with(untraced)
49
+
50
+ @installer.untrace(procedure)
51
+ end
52
+ end
53
+
54
+ describe "install_trace_support"
55
+ describe "uninstall_trace_support"
56
+
57
+ end
58
+
59
+ end
@@ -0,0 +1,73 @@
1
+ require 'spec_helper'
2
+
3
+ module Piggly
4
+
5
+ # load support code
6
+ Parser.parser
7
+
8
+ describe NodeClass do
9
+ describe "source_text"
10
+ describe "named?"
11
+
12
+ context "untagged node" do
13
+ describe "tagged?"
14
+ describe "tag_id"
15
+ describe "tag"
16
+ end
17
+
18
+ context "tagged node" do
19
+ describe "tagged?"
20
+ describe "tag_id"
21
+ describe "tag"
22
+ end
23
+ end
24
+
25
+ describe Parser::Nodes::Expression do
26
+ describe "tag" do
27
+ context "untagged node" do
28
+ context "named :cond" do
29
+ context "with parent.while?"
30
+ context "with parent.loop?"
31
+ context "with parent.branch?"
32
+ context "with some other type of parent"
33
+ end
34
+
35
+ context "not named :cond" do
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ describe Parser::Nodes::Sql do
42
+ describe "tag" do
43
+ context "untagged node" do
44
+ context "named :cond" do
45
+ context "with parent.for?"
46
+ context "with some other parent"
47
+ end
48
+
49
+ context "not named :cond"
50
+ end
51
+ end
52
+ end
53
+
54
+ describe Parser::Nodes::TKeyword do
55
+ describe "tag" do
56
+ context "untagged node" do
57
+ context "named :cond" do
58
+ context "with parent.loop?"
59
+ context "with some other parent"
60
+ end
61
+
62
+ context "not named :cond"
63
+ end
64
+ end
65
+ end
66
+
67
+ describe Parser::Nodes::Terminal do
68
+ end
69
+
70
+ describe Parser::Nodes::NotImplemented do
71
+ end
72
+
73
+ end