1
0

jose-fmt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #!/bin/sh -ex
  2. export PATH=../cmd:$PATH
  3. jose fmt -j '{}' -O
  4. ! jose fmt -j '{}' -A
  5. ! jose fmt -j '{}' -S
  6. ! jose fmt -j '{}' -I
  7. ! jose fmt -j '{}' -R
  8. ! jose fmt -j '{}' -N
  9. ! jose fmt -j '{}' -T
  10. ! jose fmt -j '{}' -F
  11. ! jose fmt -j '{}' -B
  12. ! jose fmt -j '{}' -0
  13. ! jose fmt -j '{}' -XO
  14. jose fmt -j '{}' -XA
  15. jose fmt -j '{}' -XS
  16. jose fmt -j '{}' -XI
  17. jose fmt -j '{}' -XR
  18. jose fmt -j '{}' -XN
  19. jose fmt -j '{}' -XT
  20. jose fmt -j '{}' -XF
  21. jose fmt -j '{}' -XB
  22. jose fmt -j '{}' -X0
  23. jose fmt -j '[]' -A
  24. ! jose fmt -j '[]' -XA
  25. jose fmt -j '""' -S
  26. ! jose fmt -j '""' -XS
  27. jose fmt -j '8' -I
  28. ! jose fmt -j '8' -XI
  29. jose fmt -j '2.5' -R
  30. ! jose fmt -j '2.5' -XR
  31. jose fmt -j '8' -N
  32. ! jose fmt -j '8' -XN
  33. jose fmt -j 'true' -T
  34. ! jose fmt -j 'true' -XT
  35. jose fmt -j 'false' -F
  36. ! jose fmt -j 'false' -XF
  37. jose fmt -j 'true' -B
  38. ! jose fmt -j 'true' -XB
  39. jose fmt -j 'null' -0
  40. ! jose fmt -j 'null' -X0
  41. jose fmt -j 7 -j 7 -E
  42. ! jose fmt -j 7 -j 7 -XE
  43. ! jose fmt -j 7 -j 8 -E
  44. ! jose fmt -j 7 -j 8 -XE
  45. jose fmt -j '"foo"' -j '"foo"' -E
  46. ! jose fmt -j '"foo"' -j '"foo"' -XE
  47. ! jose fmt -j '"foo"' -j '"bar"' -E
  48. ! jose fmt -j '"foo"' -j '"bar"' -XE
  49. jose fmt -q foo -S -j '"foo"' -SE
  50. ! jose fmt -o-
  51. test `jose fmt -j '{}' -o-` = "{}"
  52. test `jose fmt -j '[1,2,3]' -f- | wc -l` = "3"
  53. test `jose fmt -j '[1,2,3]' -f- | head -n 1` = "1"
  54. test `jose fmt -j '[1,2,3]' -f- | tail -n 1` = "3"
  55. test `jose fmt -j '{"a":1,"b":2}' -f- | wc -l` = "2"
  56. test `jose fmt -j '{"a":1,"b":2}' -f- | head -n 1` = "a=1"
  57. test `jose fmt -j '{"a":1,"b":2}' -f- | tail -n 1` = "b=2"
  58. test "`jose fmt -j '"foo"' -u-`" = "foo"
  59. ! jose fmt -j 7 -u-
  60. ! jose fmt -c
  61. test "`jose fmt -j '{}' -j '{"a":1}' -s x -j 7 -s a -UUo-`" = '{"x":{"a":7}}'
  62. test "`jose fmt -j '{}' -j '{"a":1}' -s x -cj 7 -s a -UUUo-`" = '{"x":{"a":1}}'
  63. test "`jose fmt -Qo-`" = "[]"
  64. test "`jose fmt -j 7 -j 8 -j 9 -Qo-`" = "[9,8,7]"
  65. ! jose fmt -M 1
  66. test "`jose fmt -j 1 -j 2 -j 3 -M 1 -o-`" = "2"
  67. test "`jose fmt -j 1 -j 2 -j 3 -M 1 -Uo-`" = "3"
  68. test "`jose fmt -j 1 -j 2 -j 3 -M 2 -o-`" = "2"
  69. test "`jose fmt -j 1 -j 2 -j 3 -M 2 -Uo-`" = "1"
  70. test "`jose fmt -j 1 -j 2 -j 3 -M 2 -UUo-`" = "3"
  71. ! jose fmt -t 0
  72. ! jose fmt -j 7 -t 0
  73. ! jose fmt -j '{}' -t 0
  74. test "`jose fmt -j '[1,2,3]' -t 0 -lo-`" = "0"
  75. test "`jose fmt -j '[1,2,3]' -t 1 -lo-`" = "1"
  76. test "`jose fmt -j '[1,2,3]' -t 2 -lo-`" = "2"
  77. test "`jose fmt -j '[1,2,3]' -t 3 -lo-`" = "3"
  78. test "`jose fmt -j '[1,2,3]' -t 4 -lo-`" = "3"
  79. ! jose fmt -i 0
  80. ! jose fmt -j '[]' -i 0
  81. ! jose fmt -j 7 -j 8 -i 0
  82. test "`jose fmt -j '[1,2]' -j 3 -i 0 -Uo-`" = "[3,1,2]"
  83. test "`jose fmt -j '[1,2]' -j 3 -i 1 -Uo-`" = "[1,3,2]"
  84. test "`jose fmt -j '[1,2]' -j 3 -i 2 -Uo-`" = "[1,2,3]"
  85. ! jose fmt -a
  86. ! jose fmt -j '[]' -a
  87. ! jose fmt -j 7 -j 8 -a
  88. test "`jose fmt -j '[1,2]' -j 3 -aUo-`" = "[1,2,3]"
  89. test "`jose fmt -j '{"foo":1}' -j '{"foo":2,"bar":2}' -aUo-`" = '{"bar":2,"foo":1}'
  90. ! jose fmt -x
  91. ! jose fmt -j '[]' -x
  92. ! jose fmt -j 7 -j 8 -x
  93. test "`jose fmt -j '[1,2]' -j '[3,4]' -xUo-`" = "[1,2,3,4]"
  94. test "`jose fmt -j '{"foo":1}' -j '{"foo":2,"bar":2}' -xUo-`" = '{"bar":2,"foo":2}'
  95. ! jose fmt -d 0
  96. ! jose fmt -j 7 -d 0
  97. ! jose fmt -j '[]' -d 0
  98. test "`jose fmt -j '[1,2]' -d 0 -o-`" = "[2]"
  99. test "`jose fmt -j '[1,2]' -d 1 -o-`" = "[1]"
  100. ! jose fmt -l
  101. ! jose fmt -j 7 -l
  102. test "`jose fmt -j '{}' -lo-`" = "0"
  103. test "`jose fmt -j '{"foo":1}' -lo-`" = "1"
  104. test "`jose fmt -j '{"foo":1,"bar":2}' -lo-`" = "2"
  105. ! jose fmt -e
  106. ! jose fmt -j 7 -e
  107. test "`jose fmt -j '[1,2,3,4]' -eo-`" = "[]"
  108. test "`jose fmt -j '{"foo":1}' -eo-`" = "{}"
  109. ! jose fmt -g bar
  110. ! jose fmt -g 0
  111. ! jose fmt -j 7 -g bar
  112. ! jose fmt -j 7 -g 0
  113. ! jose fmt -j '{"foo":1}' -g bar
  114. ! jose fmt -j '[]' -g 0
  115. test "`jose fmt -j '{"foo":1}' -g foo -o-`" = "1"
  116. test "`jose fmt -j '[1]' -g 0 -o-`" = "1"
  117. ! jose fmt -s foo
  118. ! jose fmt -s 0
  119. ! jose fmt -j '{}' -s foo
  120. ! jose fmt -j '[]' -s 0
  121. ! jose fmt -j 7 -j 8 -s foo
  122. ! jose fmt -j 7 -j 8 -s 0
  123. ! jose fmt -j '[]' -j 8 -s 0
  124. test "`jose fmt -j '{}' -j 7 -s "foo" -Uo-`" = '{"foo":7}'
  125. test "`jose fmt -j '[1,2]' -j 7 -s 0 -Uo-`" = '[7,2]'
  126. test "`jose fmt -j '[1,2]' -j 7 -s 1 -Uo-`" = '[1,7]'
  127. ! jose fmt -y
  128. ! jose fmt -Y
  129. test "`jose fmt -j '{}' -YSu-`" = "e30"
  130. test "`jose fmt -j '"e30"' -yOo-`" = "{}"