testhelper 0.1.2 → 0.1.3

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/file_line.rb +11 -3
  3. data/lib/testhelper.rb +4 -0
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb5dd37c61ef0157c150563fb326d1758535ca65
4
- data.tar.gz: fc8c1f20b9e94173f4e180bca9e7cdc4d0bde465
3
+ metadata.gz: 17d36d59b80579085adbd998d19c2703cc1ac32d
4
+ data.tar.gz: 22db431404f94ffb2957622976e0049517880b42
5
5
  SHA512:
6
- metadata.gz: 81bd1d015473242bd7db81e6c23b2b3dfad35f552b83fde6760ec29531d84b3c8c546cab37a8a525eba8828951012f775053b10e474c2cc1d11b148519da1fa3
7
- data.tar.gz: 540b96d2d28ad783f17058a00806126aad4426496e6e4120c59e5b7cc411f7b88bf7d3d3600e54341d9f4c3bc36ce93e8b7c7ea0be01c3d49065883c39175bb2
6
+ metadata.gz: 3c4248ebd5dfafaae047c589554c4ac75c741228dcb273c60be13fba4e557677fde039ec1ef08909f135074ea7f3774075854ceb9de3f5a1be7b7655ebf35760
7
+ data.tar.gz: 5e344049c6dd1fd4029a00cc1478fdf8383ff0ad0fd1dfe5473d0323138c94f969d5a9f1184da62b5cee15c1494b1ef4fbee1b8d53249a48d622fef08e40b2d3
data/lib/file_line.rb CHANGED
@@ -14,7 +14,7 @@ module SourceFile
14
14
  end
15
15
 
16
16
  def self.analyze_variable_name(the_line, the_callee)
17
- the_line.slice(0, the_line.index(the_callee.to_s)-1).strip()
17
+ the_line.slice(0, the_line.rindex("."+the_callee.to_s)).strip()
18
18
  end
19
19
 
20
20
  def self.get_variable_name(location_str, the_callee)
@@ -30,9 +30,9 @@ if __FILE__ == $0
30
30
  describe FileLine do
31
31
  it "get line from the file" do
32
32
  file_path = "../testhelper.gemspec"
33
- line_no = 3
33
+ line_no = 2
34
34
  FileLine.get(file_path, line_no).must_equal(
35
- " s.version = '0.0.1'\n")
35
+ " s.name = 'testhelper'\n")
36
36
  end
37
37
  end
38
38
 
@@ -46,6 +46,14 @@ if __FILE__ == $0
46
46
  the_line = " mm.ppt()\n"
47
47
  the_callee = :ppt
48
48
  SourceFile.analyze_variable_name(the_line, the_callee).must_equal("mm")
49
+
50
+ the_line = " ct.depth.pt()\n"
51
+ the_callee = :pt
52
+ SourceFile.analyze_variable_name(the_line, the_callee).must_equal("ct.depth")
53
+
54
+ the_line = " ct.depth.pt('depth')\n"
55
+ the_callee = :pt
56
+ SourceFile.analyze_variable_name(the_line, the_callee).must_equal("ct.depth")
49
57
  end
50
58
  end
51
59
  end
data/lib/testhelper.rb CHANGED
@@ -65,6 +65,9 @@ if __FILE__ == $0
65
65
  def inspect()
66
66
  "ColinTest"
67
67
  end
68
+ def depth
69
+ 5
70
+ end
68
71
  alias to_str inspect
69
72
  end
70
73
  name = "Test Helper"
@@ -74,6 +77,7 @@ if __FILE__ == $0
74
77
  name.ppt("Tt's the name")
75
78
 
76
79
  ct = ColinTest.new()
80
+ ct.depth.pt()
77
81
  ct.ptl()
78
82
  ct.ptl("It's a new instance.")
79
83
  ct.pptl()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testhelper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Ji
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-30 00:00:00.000000000 Z
11
+ date: 2014-08-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Some print helper methods like pt, ptl, ppt, pptl, flag_test for testing.
14
14
  email: jichen3000@gmail.com