rufus-treechecker 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+
2
+ require 'rufus/treechecker'
3
+
@@ -125,16 +125,21 @@ module Rufus
125
125
  #
126
126
  class TreeChecker
127
127
 
128
- VERSION = '1.0.2'
128
+ VERSION = '1.0.3'
129
129
 
130
130
  #
131
131
  # pretty-prints the sexp tree of the given rubycode
132
132
  #
133
133
  def ptree (rubycode)
134
- puts
135
- puts rubycode.inspect
136
- puts " => "
137
- puts parse(rubycode).inspect
134
+ puts stree(rubycode)
135
+ end
136
+
137
+ #
138
+ # returns the pretty-printed string of the given rubycode
139
+ # (thanks ruby_parser).
140
+ #
141
+ def stree (rubycode)
142
+ "#{rubycode.inspect}\n =>\n#{parse(rubycode).inspect}"
138
143
  end
139
144
 
140
145
  #
@@ -481,7 +486,7 @@ module Rufus
481
486
  #
482
487
  def exclude_eval
483
488
 
484
- exclude_fcall(:eval, 'eval() is forbidden')
489
+ exclude_call_to(:eval, 'eval() is forbidden')
485
490
  exclude_call_to(:module_eval, 'module_eval() is forbidden')
486
491
  exclude_call_to(:instance_eval, 'instance_eval() is forbidden')
487
492
  end
data/test/ft_0_basic.rb CHANGED
@@ -19,8 +19,10 @@ class BasicTest < Test::Unit::TestCase
19
19
  tc = Rufus::TreeChecker.new do
20
20
  exclude_vcall :abort
21
21
  exclude_fcall :abort
22
+ exclude_call_to :abort
22
23
  exclude_fvcall :exit, :exit!
23
24
  exclude_call_to :exit
25
+ exclude_call_to :exit!
24
26
  end
25
27
 
26
28
  assert_nok(tc, 'exit')
@@ -130,6 +132,7 @@ class BasicTest < Test::Unit::TestCase
130
132
  end
131
133
 
132
134
  assert_nok(tc, 'eval("code")')
135
+ assert_nok(tc, 'Kernel.eval("code")')
133
136
  assert_nok(tc, 'toto.instance_eval("code")')
134
137
  assert_nok(tc, 'Toto.module_eval("code")')
135
138
  end
@@ -161,9 +164,9 @@ class BasicTest < Test::Unit::TestCase
161
164
  def test_10_exclude_public
162
165
 
163
166
  tc = Rufus::TreeChecker.new do
164
- exclude_fvcall :public
165
- exclude_fvcall :protected
166
- exclude_fvcall :private
167
+ exclude_fvccall :public
168
+ exclude_fvccall :protected
169
+ exclude_fvccall :private
167
170
  end
168
171
 
169
172
  assert_nok(tc, 'public')
data/test/testmixin.rb CHANGED
@@ -18,7 +18,7 @@ module TestMixin
18
18
  tc.check(rubycode)
19
19
  end
20
20
  def assert_nok (tc, rubycode)
21
- assert_raise Rufus::SecurityError do
21
+ assert_raise Rufus::SecurityError, tc.stree(rubycode) do
22
22
  tc.check(rubycode)
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufus-treechecker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux
@@ -9,11 +9,11 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-02 00:00:00 +09:00
12
+ date: 2008-10-29 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: rogue_parser
16
+ name: ruby_parser
17
17
  type: :runtime
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
@@ -33,6 +33,7 @@ extra_rdoc_files:
33
33
  files:
34
34
  - lib/rufus
35
35
  - lib/rufus/treechecker.rb
36
+ - lib/rufus-treechecker.rb
36
37
  - test/bm.rb
37
38
  - test/ft_0_basic.rb
38
39
  - test/ft_1_old_treechecker.rb
@@ -60,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
61
  version: "0"
61
62
  version:
62
63
  requirements:
63
- - rogue_parser
64
+ - ruby_parser
64
65
  rubyforge_project: rufus
65
66
  rubygems_version: 1.2.0
66
67
  signing_key: