lazy-pp-json 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7140db98d85d568b58d03a9bd826d302ea631194
4
- data.tar.gz: 92a3bf4d3baeba9d11c164aa8d9bd32379e5e9fd
3
+ metadata.gz: bed24ae16f915588c3a5feb5636c9b3e42181534
4
+ data.tar.gz: 510e16a5a6e611ac79b55c9c871d11e7838effa4
5
5
  SHA512:
6
- metadata.gz: 75120bb703e9c8e86f00a0341fff6e683653b06b7219d1443998d11e58edb43ee43f22bede6b469a4f09b8aefc73b22c5e7914355c6d77a1ac8752a99948d986
7
- data.tar.gz: 1a43b0706df04339bdb92c0a23d30dc9b052758c82625b5b9912d42721c6c623a66fc8580e0574934997dda9470eecbacefcc85881d6908cf7c0f14a52321be2
6
+ metadata.gz: 9a375c877f5ab675c1cf002b48b6151dfbbc646fa636cf3ea46abfdb05b6a5a2aa7cd63933f586f96bc07c104b85d54dd763e5325605e0423e27c798168b1a9f
7
+ data.tar.gz: df45f79cd8b8a81a007002e14e02f5824c0bfbca0140bb052a860e2c2375f7757a4acd0dfd34b48481a8f3fc2b6f47170f292e2fec2c26d2344726fa332e6702
data/bin/lazy-pp-json CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  require "lazy-pp-json"
5
5
 
6
- if ARGV.size > 1
6
+ if ARGV.empty? or ARGV.size > 1
7
7
  puts <<DESCRIPTION
8
8
  error: lazy-pp-json should have 1 argument only.
9
9
 
@@ -3,7 +3,7 @@
3
3
  module Lazy
4
4
  module PP
5
5
  class JSON < String
6
- VERSION = "0.0.3"
6
+ VERSION = "0.0.4"
7
7
  end
8
8
  end
9
9
  end
data/test/test_array.rb CHANGED
@@ -12,6 +12,10 @@ module Lazy
12
12
  assert_lazy_json("[]\n", '[]')
13
13
  end
14
14
 
15
+ def test_numeric
16
+ assert_lazy_json('[1]' + "\n", '[1]')
17
+ end
18
+
15
19
  def test_short_single
16
20
  assert_lazy_json('["1"]' + "\n", '["1"]')
17
21
  end
data/test/test_hash.rb CHANGED
@@ -12,6 +12,14 @@ module Lazy
12
12
  assert_lazy_json("{}\n", '{}')
13
13
  end
14
14
 
15
+ def test_numeric
16
+ assert_lazy_json(<<EXPECTED, '{"key":2}')
17
+ {
18
+ "key":2
19
+ }
20
+ EXPECTED
21
+ end
22
+
15
23
  def test_single
16
24
  assert_lazy_json(<<EXPECTED, '{"key":"value"}')
17
25
  {
data/test/testutils.rb CHANGED
@@ -19,22 +19,12 @@ module Lazy
19
19
  ["#{LONG_STRING[0..25]}", "#{LONG_STRING[26..51]}"]
20
20
  ACTUAL
21
21
 
22
- def setup
23
- @original_stdout = $stdout.dup
24
- @stdout = StringIO.new
25
- $stdout = @stdout
26
- end
27
-
28
- def teardown
29
- $stdout = @original_stdout
30
- end
31
-
32
22
  private
33
23
 
34
24
  def assert_lazy_json(expected, actual_string)
35
25
  actual = Lazy::PP::JSON.new(actual_string)
36
- pp(actual)
37
- assert_equal(expected, @stdout.string, @stdout.string)
26
+ output = actual.pretty_inspect
27
+ assert_equal(expected, output, output)
38
28
  end
39
29
  end
40
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazy-pp-json
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshihara