ss2json 1.0.0.pre → 1.0.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +6 -6
- data/bin/ss2json +2 -0
- data/lib/ss2json/converter.rb +1 -0
- data/lib/ss2json/version.rb +1 -1
- data/test/commands/constants/constants_test.rb +20 -0
- data/test/commands/constants/output_constants.txt +15 -0
- data/test/commands/constants/output_constants_table.txt +9 -0
- data/test/commands/constants/table.csv +4 -0
- data/test/commands/to_array/output_to_array.txt +15 -0
- data/test/commands/to_array/output_to_array_table.txt +13 -0
- data/test/commands/to_array/table.csv +5 -0
- data/test/commands/to_array/to_array_test.rb +22 -0
- data/test/commands/to_hash/output_to_hash.txt +15 -0
- data/test/commands/to_hash/output_to_hash_table.txt +13 -0
- data/test/commands/to_hash/table.csv +5 -0
- data/test/commands/to_hash/to_hash_test.rb +22 -0
- data/test/row_converter_test.rb +14 -14
- metadata +27 -16
- data/test/cli_test.rb +0 -61
- data/test/integration_test.rb +0 -90
data/Rakefile
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require 'rubygems'
|
3
|
-
require 'bundler/setup'
|
4
3
|
|
5
4
|
|
6
5
|
|
@@ -9,8 +8,9 @@ require 'bundler/setup'
|
|
9
8
|
# sh "ruby -I lib -rubygems test/**/*_test.rb"
|
10
9
|
# end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
11
|
+
require 'rake/testtask'
|
12
|
+
|
13
|
+
Rake::TestTask.new do |t|
|
14
|
+
t.pattern = "test/**/*_test.rb"
|
15
|
+
t.verbose = true
|
16
|
+
end
|
data/bin/ss2json
CHANGED
@@ -5,6 +5,8 @@ if ARGV[0] && !(ARGV[0] =~ /^-/)
|
|
5
5
|
require "ss2json-commands/#{ARGV[0]}"
|
6
6
|
kommand = SS2JSON::Command.const_get(ARGV[0].gsub(/^.|_./){|a| a[-1].chr.upcase})
|
7
7
|
$0="#{$0} #{ARGV[0]}"
|
8
|
+
kommand.new(ARGV[1..-1])
|
9
|
+
rescue LoadError => e
|
8
10
|
$stderr.puts "ss2json: '#{ARGV[0]}' is not a ss2json command. See 'ss2json --help'. (#{e.message})"
|
9
11
|
exit -1
|
10
12
|
end
|
data/lib/ss2json/converter.rb
CHANGED
data/lib/ss2json/version.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class ToConstantsCommandTest < Test::Unit::TestCase
|
5
|
+
CMD="ruby -I lib -rubygems bin/ss2json constants"
|
6
|
+
|
7
|
+
# Fixture helper
|
8
|
+
def f(name); File.join( File.dirname(__FILE__), name ) ; end
|
9
|
+
def r(path); File.read f(path); end
|
10
|
+
|
11
|
+
def test_without_commands
|
12
|
+
assert_equal r("output_constants.txt"), `#{CMD} 2>&1`
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_to_constants
|
16
|
+
output = `#{CMD} #{f "table.csv"} | python -mjson.tool`
|
17
|
+
assert_equal r("output_constants_table.txt"), output
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Incorrect number of parameters
|
2
|
+
Usage: bin/ss2json constants FILENAME [options]
|
3
|
+
-s, --sheet SHEET_NAME Use other that the first table
|
4
|
+
-r, --first-row ROW_NUMBER Set the first row
|
5
|
+
-k, --key-column COLUMN_NUMBER Column where the keys are (Default to 1)
|
6
|
+
-a, --value-column COLUMN_NUMBER Column where the values are (Default to 2)
|
7
|
+
|
8
|
+
Data options:
|
9
|
+
-i, --ignore-value VALUE Ignore the fields with that value. Could be use several times
|
10
|
+
-b, --include-blank Generate a json with the values included in the ignore list
|
11
|
+
-d, --disable-conversion Disable the conversion from floats to integers
|
12
|
+
-l, --disable-first-letter Will disable the downcase of the first letter of the key
|
13
|
+
|
14
|
+
-h, --help Show this help
|
15
|
+
--version Show the version
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Incorrect number of parameters
|
2
|
+
Usage: bin/ss2json to_array FILENAME [options]
|
3
|
+
-s, --sheet SHEET_NAME Use other that the first table
|
4
|
+
-t, --title-row ROW_NUMBER Row in wich the titles are. Default: 1
|
5
|
+
-r, --first-row ROW_NUMBER Set the first row
|
6
|
+
-c, --check-column NAME Only output objects wich his property NAME is not in IGNORED VALUES
|
7
|
+
|
8
|
+
Data options:
|
9
|
+
-i, --ignore-value VALUE Ignore the fields with that value. Could be use several times
|
10
|
+
-b, --include-blank Generate a json with the values included in the ignore list
|
11
|
+
-d, --disable-conversion Disable the conversion from floats to integers
|
12
|
+
-l, --disable-first-letter Will disable the downcase of the first letter of the key
|
13
|
+
|
14
|
+
-h, --help Show this help
|
15
|
+
--version Show the version
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class ToArrayCommandTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
|
7
|
+
CMD="ruby -I lib -rubygems bin/ss2json to_array"
|
8
|
+
|
9
|
+
# Fixture helper
|
10
|
+
def f(name); File.join( File.dirname(__FILE__), name ) ; end
|
11
|
+
def r(path); File.read f(path); end
|
12
|
+
|
13
|
+
def test_without_commands
|
14
|
+
assert_equal r("output_to_array.txt"), `#{CMD} 2>&1`
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_to_array
|
18
|
+
output = `#{CMD} #{f "table.csv"} | python -mjson.tool`
|
19
|
+
assert_equal r("output_to_array_table.txt"), output
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
Incorrect number of parameters
|
2
|
+
Usage: bin/ss2json to_hash FILENAME KEY [options]
|
3
|
+
-s, --sheet SHEET_NAME Use other that the first table
|
4
|
+
-t, --title-row ROW_NUMBER Row in wich the titles are. Default: 1
|
5
|
+
-r, --first-row ROW_NUMBER Set the first row of real data. Default: 2
|
6
|
+
-n, --dont-remove-key When using a column in the excel as a key for the hash, that column is removed. This option avoid that behaviour
|
7
|
+
|
8
|
+
Data options:
|
9
|
+
-i, --ignore-value VALUE Ignore the fields with that value. Could be use several times
|
10
|
+
-b, --include-blank Generate a json with the values included in the ignore list
|
11
|
+
-d, --disable-conversion Disable the conversion from floats to integers
|
12
|
+
-l, --disable-first-letter Will disable the downcase of the first letter of the key
|
13
|
+
|
14
|
+
-h, --help Show this help
|
15
|
+
--version Show the version
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
class ToHashCommandTest < Test::Unit::TestCase
|
5
|
+
|
6
|
+
|
7
|
+
CMD="ruby -I lib -rubygems bin/ss2json to_hash"
|
8
|
+
|
9
|
+
# Fixture helper
|
10
|
+
def f(name); File.join( File.dirname(__FILE__), name ) ; end
|
11
|
+
def r(path); File.read f(path); end
|
12
|
+
|
13
|
+
def test_without_commands
|
14
|
+
assert_equal r("output_to_hash.txt"), `#{CMD} 2>&1`
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_to_hash
|
18
|
+
output = `#{CMD} #{f "table.csv"} id | python -mjson.tool`
|
19
|
+
assert_equal r("output_to_hash_table.txt"), output
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
data/test/row_converter_test.rb
CHANGED
@@ -1,60 +1,60 @@
|
|
1
|
-
|
2
|
-
require 'ss2json'
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ss2json/row_converter'
|
3
3
|
require 'test/unit'
|
4
4
|
|
5
|
-
class
|
5
|
+
class SS2JSON::RowConverterTest < Test::Unit::TestCase
|
6
6
|
|
7
7
|
def test_class
|
8
|
-
nested_hash =
|
8
|
+
nested_hash = SS2JSON::RowConverter.new({})
|
9
9
|
nested_hash.is_a?(Hash)
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_ignored_values_option
|
13
13
|
options = {:ignored_values => ["???"]}
|
14
|
-
new_hash =
|
14
|
+
new_hash = SS2JSON::RowConverter.new({"adsf" => '???'},options)
|
15
15
|
assert_equal({}, new_hash)
|
16
|
-
new_hash =
|
16
|
+
new_hash = SS2JSON::RowConverter.new({"asdf" => 'asdf'}, options)
|
17
17
|
assert_equal({"asdf" => 'asdf' }, new_hash)
|
18
18
|
end
|
19
19
|
|
20
20
|
def test_show_null_option
|
21
21
|
initial_hash = {"asdf" => nil}
|
22
|
-
new_hash =
|
22
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash,{:show_null => false})
|
23
23
|
assert_equal({}, new_hash)
|
24
24
|
|
25
|
-
new_hash =
|
25
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash,{:show_null => true})
|
26
26
|
assert_equal({"asdf" => nil}, new_hash)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_dont_convert_option
|
30
30
|
initial_hash = { "asdf" => 3.0 }
|
31
31
|
|
32
|
-
new_hash =
|
32
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash, {:dont_convert => true})
|
33
33
|
assert_equal(initial_hash, new_hash)
|
34
34
|
|
35
|
-
new_hash =
|
35
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash, {:dont_convert => false})
|
36
36
|
assert_equal(initial_hash, { "asdf" => 3 })
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_downcase_first_letter
|
40
40
|
initial_hash = { "Asdf.pepe" => 3, "asdf.Jose" => 5 }
|
41
41
|
|
42
|
-
new_hash =
|
42
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash, {:downcase_first_letter => false})
|
43
43
|
assert_equal({"Asdf"=>{"pepe"=>3}, "asdf"=>{"Jose"=>5}}, new_hash)
|
44
44
|
|
45
|
-
new_hash =
|
45
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash, {:downcase_first_letter => true})
|
46
46
|
assert_equal({"asdf" => {"pepe" => 3, "jose" => 5}}, new_hash)
|
47
47
|
end
|
48
48
|
|
49
49
|
def test_it_ignore_ignored_fields
|
50
50
|
initial_hash = { "i.asdf" => 5}
|
51
51
|
|
52
|
-
new_hash =
|
52
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash)
|
53
53
|
assert_equal({}, new_hash)
|
54
54
|
|
55
55
|
initial_hash = { "name.i" => 5}
|
56
56
|
|
57
|
-
new_hash =
|
57
|
+
new_hash = SS2JSON::RowConverter.new(initial_hash)
|
58
58
|
assert_equal({"name" => {"i" => 5}}, new_hash)
|
59
59
|
end
|
60
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ss2json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: -782823030
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
9
|
- 0
|
10
10
|
- pre
|
11
|
-
|
11
|
+
- 1
|
12
|
+
version: 1.0.0.pre1
|
12
13
|
platform: ruby
|
13
14
|
authors:
|
14
15
|
- "Guillermo A\xCC\x81lvarez"
|
@@ -19,9 +20,9 @@ cert_chain: []
|
|
19
20
|
date: 2012-09-10 00:00:00 Z
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
23
|
name: nested_hash
|
24
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
26
|
none: false
|
26
27
|
requirements:
|
27
28
|
- - ">="
|
@@ -30,12 +31,12 @@ dependencies:
|
|
30
31
|
segments:
|
31
32
|
- 0
|
32
33
|
version: "0"
|
33
|
-
requirement: *id001
|
34
34
|
type: :runtime
|
35
|
+
version_requirements: *id001
|
35
36
|
- !ruby/object:Gem::Dependency
|
36
|
-
prerelease: false
|
37
37
|
name: roo
|
38
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
40
|
none: false
|
40
41
|
requirements:
|
41
42
|
- - ">="
|
@@ -44,12 +45,12 @@ dependencies:
|
|
44
45
|
segments:
|
45
46
|
- 0
|
46
47
|
version: "0"
|
47
|
-
requirement: *id002
|
48
48
|
type: :runtime
|
49
|
+
version_requirements: *id002
|
49
50
|
- !ruby/object:Gem::Dependency
|
50
|
-
prerelease: false
|
51
51
|
name: terminal-table
|
52
|
-
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
54
|
none: false
|
54
55
|
requirements:
|
55
56
|
- - ">="
|
@@ -58,12 +59,12 @@ dependencies:
|
|
58
59
|
segments:
|
59
60
|
- 0
|
60
61
|
version: "0"
|
61
|
-
requirement: *id003
|
62
62
|
type: :runtime
|
63
|
+
version_requirements: *id003
|
63
64
|
- !ruby/object:Gem::Dependency
|
64
|
-
prerelease: false
|
65
65
|
name: json
|
66
|
-
|
66
|
+
prerelease: false
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
68
|
none: false
|
68
69
|
requirements:
|
69
70
|
- - ">="
|
@@ -72,8 +73,8 @@ dependencies:
|
|
72
73
|
segments:
|
73
74
|
- 0
|
74
75
|
version: "0"
|
75
|
-
requirement: *id004
|
76
76
|
type: :runtime
|
77
|
+
version_requirements: *id004
|
77
78
|
description: Convert SpreadSheet documents to json following some conventions.
|
78
79
|
email:
|
79
80
|
- guillermo@cientifico.net
|
@@ -108,8 +109,18 @@ files:
|
|
108
109
|
- ss2json.gemspec
|
109
110
|
- test/catss.fixture
|
110
111
|
- test/catss2.fixture
|
111
|
-
- test/
|
112
|
-
- test/
|
112
|
+
- test/commands/constants/constants_test.rb
|
113
|
+
- test/commands/constants/output_constants.txt
|
114
|
+
- test/commands/constants/output_constants_table.txt
|
115
|
+
- test/commands/constants/table.csv
|
116
|
+
- test/commands/to_array/output_to_array.txt
|
117
|
+
- test/commands/to_array/output_to_array_table.txt
|
118
|
+
- test/commands/to_array/table.csv
|
119
|
+
- test/commands/to_array/to_array_test.rb
|
120
|
+
- test/commands/to_hash/output_to_hash.txt
|
121
|
+
- test/commands/to_hash/output_to_hash_table.txt
|
122
|
+
- test/commands/to_hash/table.csv
|
123
|
+
- test/commands/to_hash/to_hash_test.rb
|
113
124
|
- test/row_converter_test.rb
|
114
125
|
- test/ss2json (1).ods
|
115
126
|
- test/ss2json.ods
|
data/test/cli_test.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'ss2json'
|
4
|
-
require 'test/unit'
|
5
|
-
|
6
|
-
class Ss2Json::RowConverterTest < Test::Unit::TestCase
|
7
|
-
|
8
|
-
def test_class
|
9
|
-
nested_hash = Ss2Json::RowConverter.new({})
|
10
|
-
nested_hash.is_a?(Hash)
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_ignored_values_option
|
14
|
-
options = {:ignored_values => ["???"]}
|
15
|
-
new_hash = Ss2Json::RowConverter.new({"adsf" => '???'},options)
|
16
|
-
assert_equal({}, new_hash)
|
17
|
-
new_hash = Ss2Json::RowConverter.new({"asdf" => 'asdf'}, options)
|
18
|
-
assert_equal({"asdf" => 'asdf' }, new_hash)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_show_null_option
|
22
|
-
initial_hash = {"asdf" => nil}
|
23
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash,{:show_null => false})
|
24
|
-
assert_equal({}, new_hash)
|
25
|
-
|
26
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash,{:show_null => true})
|
27
|
-
assert_equal({"asdf" => nil}, new_hash)
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_dont_convert_option
|
31
|
-
initial_hash = { "asdf" => 3.0 }
|
32
|
-
|
33
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash, {:dont_convert => true})
|
34
|
-
assert_equal(initial_hash, new_hash)
|
35
|
-
|
36
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash, {:dont_convert => false})
|
37
|
-
assert_equal(initial_hash, { "asdf" => 3 })
|
38
|
-
end
|
39
|
-
|
40
|
-
def test_downcase_first_letter
|
41
|
-
initial_hash = { "Asdf.pepe" => 3, "asdf.Jose" => 5 }
|
42
|
-
|
43
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash, {:downcase_first_letter => false})
|
44
|
-
assert_equal({"Asdf"=>{"pepe"=>3}, "asdf"=>{"Jose"=>5}}, new_hash)
|
45
|
-
|
46
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash, {:downcase_first_letter => true})
|
47
|
-
assert_equal({"asdf" => {"pepe" => 3, "jose" => 5}}, new_hash)
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_it_ignore_ignored_fields
|
51
|
-
initial_hash = { "i.asdf" => 5}
|
52
|
-
|
53
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash)
|
54
|
-
assert_equal({}, new_hash)
|
55
|
-
|
56
|
-
initial_hash = { "name.i" => 5}
|
57
|
-
|
58
|
-
new_hash = Ss2Json::RowConverter.new(initial_hash)
|
59
|
-
assert_equal({"name" => {"i" => 5}}, new_hash)
|
60
|
-
end
|
61
|
-
end
|
data/test/integration_test.rb
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
class Ss2JsonIntegrationTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
def call(cmd, args)
|
8
|
-
`ruby -I lib -rubygems bin/#{cmd} #{args}`
|
9
|
-
end
|
10
|
-
|
11
|
-
def callP(cmd,args)
|
12
|
-
JSON.parse(call(cmd,args))
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# def test_vertical
|
18
|
-
# data = [ { "child"=>[{"name"=>"pepe", "age"=>2}, {"name"=>"Juanjo"}], "id"=>1, "name"=>{"last"=>"Alvarez", "first"=>"Guillermo"} }, { "child"=>[{"name"=>"Jr"}], "id"=>2, "name"=>{"last"=>"Luther", "first"=>"Martin"} }, {"id"=>3, "name"=>{"first"=>"Jesper"}}, {"id"=>4}, {"id"=>5}, {"id"=>6}]
|
19
|
-
# assert_equal data, ss2jsonP("-f test/ss2json.xls -s Test1")
|
20
|
-
# end
|
21
|
-
|
22
|
-
# def test_check_flag
|
23
|
-
# data = [{"child"=>[{"name"=>"pepe", "age"=>2}, {"name"=>"Juanjo"}], "name"=>{"last"=>"Alvarez", "first"=>"Guillermo"}, "id"=>1}, {"child"=>[{"name"=>"Jr"}], "name"=>{"last"=>"Luther", "first"=>"Martin"}, "id"=>2}, {"name"=>{"first"=>"Jesper"}, "id"=>3}]
|
24
|
-
# assert_equal data, ss2jsonP("-f test/ss2json.xls -s Test1 -c 'name'")
|
25
|
-
# end
|
26
|
-
|
27
|
-
# def test_use_key
|
28
|
-
# data = []
|
29
|
-
# assert_equal data, ss2jsonP("-f test/ss2json.xls -s Test1 -u 'uuid'")
|
30
|
-
# end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
def test_lsss
|
35
|
-
assert_equal "Test1\nTest2\nTest3\nTest4\n", call('lsss', 'test/ss2json.xls')
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_catss
|
39
|
-
expected = File.read('test/catss.fixture')
|
40
|
-
assert_equal expected , call('catss', 'test/ss2json.xls')
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_catss_with_sheet
|
44
|
-
expected = File.read('test/catss2.fixture')
|
45
|
-
assert_equal expected , call('catss', 'test/ss2json.xls Test3')
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_ss2json_horizontal
|
49
|
-
expected = [
|
50
|
-
{ "child"=> [ { "age"=> 2, "name"=> "pepe" }, { "name"=> "Juanjo" } ], "id"=> 1, "name"=> { "last"=> "Alvarez", "first"=> "Guillermo" } },
|
51
|
-
{ "child"=> [ { "name"=> "Jr" } ], "id"=> 2, "name"=> { "last"=> "Luther", "first"=> "Martin" } },
|
52
|
-
{ "id"=> 3, "name"=> { "first"=> "Jesper" } },
|
53
|
-
{ "id"=> 4 },
|
54
|
-
{ "id"=> 5 },
|
55
|
-
{ "id"=> 6 }
|
56
|
-
]
|
57
|
-
assert_equal expected, callP('ss2json-horizontal', 'test/ss2json.xls -s Test1')
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_ss2json_horizontal_with_check
|
61
|
-
expected = [
|
62
|
-
{ "child"=> [ { "age"=> 2, "name"=> "pepe" }, { "name"=> "Juanjo" } ], "id"=> 1, "name"=> { "last"=> "Alvarez", "first"=> "Guillermo" } },
|
63
|
-
{ "child"=> [ { "name"=> "Jr" } ], "id"=> 2, "name"=> { "last"=> "Luther", "first"=> "Martin" } },
|
64
|
-
{ "id"=> 3, "name"=> { "first"=> "Jesper" } }
|
65
|
-
]
|
66
|
-
assert_equal expected, callP('ss2json-horizontal', 'test/ss2json.xls -s Test1 -c name')
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_ss2json_hash
|
70
|
-
expected = [
|
71
|
-
{ "child"=> [ { "age"=> 2, "name"=> "pepe" }, { "name"=> "Juanjo" } ], "id"=> 1, "name"=> { "last"=> "Alvarez", "first"=> "Guillermo" } },
|
72
|
-
{ "child"=> [ { "name"=> "Jr" } ], "id"=> 2, "name"=> { "last"=> "Luther", "first"=> "Martin" } },
|
73
|
-
{ "id"=> 3, "name"=> { "first"=> "Jesper" } }
|
74
|
-
]
|
75
|
-
assert_equal expected, callP('ss2json-horizontal-hash', 'test/ss2json.xls id -s Test1')
|
76
|
-
end
|
77
|
-
|
78
|
-
def test_ss2json_vertical
|
79
|
-
expected = {}
|
80
|
-
assert_equal expected, callP('ss2json-vertical', 'test/ss2json.xls -s Test3')
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
# compress-json
|
85
|
-
# merge-jsons
|
86
|
-
# order-json
|
87
|
-
# ss2json-horizontal
|
88
|
-
# ss2json-horizontal-hash
|
89
|
-
# ss2json-vertical
|
90
|
-
end
|