code_analyzer 0.4.6 → 0.4.7
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.
- checksums.yaml +4 -4
- data/lib/code_analyzer/sexp.rb +1 -1
- data/lib/code_analyzer/version.rb +1 -1
- data/spec/code_analyzer/sexp_spec.rb +15 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f096548a5fcf0ca019fb0068dd47e61210d3fde
|
4
|
+
data.tar.gz: cf822ded2b3877d376de8d24544fc7e0fac71407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d3d8e34925d5dd51a7ff90301471b34ece615da44ce4162f8f7bbcb81d6cc1f802c010271273089afab22f294ee645484fdedab94cbae2f6d29bf456f4a36e4
|
7
|
+
data.tar.gz: dce0865b374883dc860951ce23496641ef04644c59a70bd6d50053778e9bc8b41afe063b999462cc875922f9e2fba28baadee9c2059116b65b05b08352c625b3
|
data/lib/code_analyzer/sexp.rb
CHANGED
@@ -737,7 +737,7 @@ class Sexp
|
|
737
737
|
def array_values
|
738
738
|
case sexp_type
|
739
739
|
when :array
|
740
|
-
if nil == self[1]
|
740
|
+
if nil == self[1] || [:words_new, :qwords_new, :qsymbols_new].include?(self[1].sexp_type)
|
741
741
|
[]
|
742
742
|
elsif [:words_add, :qwords_add, :qsymbols_add].include? self[1].sexp_type
|
743
743
|
self[1].array_values
|
@@ -563,16 +563,31 @@ describe Sexp do
|
|
563
563
|
expect(node.array_values.map(&:to_s)).to eq ["day", "week", "fortnight"]
|
564
564
|
end
|
565
565
|
|
566
|
+
it "should get empty array values with array and words_add" do
|
567
|
+
node = parse_content("%W{}").grep_node(sexp_type: :array)
|
568
|
+
expect(node.array_values.map(&:to_s)).to eq []
|
569
|
+
end
|
570
|
+
|
566
571
|
it "should get array value with array and qwords_add" do
|
567
572
|
node = parse_content("%w(first_name last_name)").grep_node(sexp_type: :array)
|
568
573
|
expect(node.array_values.map(&:to_s)).to eq ["first_name", "last_name"]
|
569
574
|
end
|
570
575
|
|
576
|
+
it "should get empty array values with array and qwords_add" do
|
577
|
+
node = parse_content("%w()").grep_node(sexp_type: :array)
|
578
|
+
expect(node.array_values.map(&:to_s)).to eq []
|
579
|
+
end
|
580
|
+
|
571
581
|
if RUBY_VERSION.to_i > 1
|
572
582
|
it "should get array value with array and qsymbols_add" do
|
573
583
|
node = parse_content("%i(first_name last_name)").grep_node(sexp_type: :array)
|
574
584
|
expect(node.array_values.map(&:to_s)).to eq ["first_name", "last_name"]
|
575
585
|
end
|
586
|
+
|
587
|
+
it "should get empty array values with array and qsymbols_new" do
|
588
|
+
node = parse_content("%i()").grep_node(sexp_type: :array)
|
589
|
+
expect(node.array_values.map(&:to_s)).to eq []
|
590
|
+
end
|
576
591
|
end
|
577
592
|
end
|
578
593
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: code_analyzer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sexp_processor
|