basic.json 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. [{
  2. "given":
  3. {"foo": {"bar": {"baz": "correct"}}},
  4. "cases": [
  5. {
  6. "expression": "foo",
  7. "result": {"bar": {"baz": "correct"}}
  8. },
  9. {
  10. "expression": "foo.bar",
  11. "result": {"baz": "correct"}
  12. },
  13. {
  14. "expression": "foo.bar.baz",
  15. "result": "correct"
  16. },
  17. {
  18. "expression": "foo\n.\nbar\n.baz",
  19. "result": "correct"
  20. },
  21. {
  22. "expression": "foo . bar . baz",
  23. "result": "correct"
  24. },
  25. {
  26. "expression": "foo\t.\tbar\t.\tbaz",
  27. "result": "correct"
  28. },
  29. {
  30. "expression": "foo\r.\rbar\r.\rbaz",
  31. "result": "correct"
  32. },
  33. {
  34. "expression": "foo\r\n.\r\nbar\r\n.\r\nbaz",
  35. "result": "correct"
  36. },
  37. {
  38. "expression": "foo.bar.baz.bad",
  39. "result": null
  40. },
  41. {
  42. "expression": "foo.bar.bad",
  43. "result": null
  44. },
  45. {
  46. "expression": "foo.bad",
  47. "result": null
  48. },
  49. {
  50. "expression": "bad",
  51. "result": null
  52. },
  53. {
  54. "expression": "bad.morebad.morebad",
  55. "result": null
  56. }
  57. ]
  58. },
  59. {
  60. "given":
  61. {"foo": {"bar": ["one", "two", "three"]}},
  62. "cases": [
  63. {
  64. "expression": "foo",
  65. "result": {"bar": ["one", "two", "three"]}
  66. },
  67. {
  68. "expression": "foo.bar",
  69. "result": ["one", "two", "three"]
  70. }
  71. ]
  72. },
  73. {
  74. "given": ["one", "two", "three"],
  75. "cases": [
  76. {
  77. "expression": "one",
  78. "result": null
  79. },
  80. {
  81. "expression": "two",
  82. "result": null
  83. },
  84. {
  85. "expression": "three",
  86. "result": null
  87. },
  88. {
  89. "expression": "one.two",
  90. "result": null
  91. }
  92. ]
  93. },
  94. {
  95. "given":
  96. {"foo": {"1": ["one", "two", "three"], "-1": "bar"}},
  97. "cases": [
  98. {
  99. "expression": "foo.\"1\"",
  100. "result": ["one", "two", "three"]
  101. },
  102. {
  103. "expression": "foo.\"1\"[0]",
  104. "result": "one"
  105. },
  106. {
  107. "expression": "foo.\"-1\"",
  108. "result": "bar"
  109. }
  110. ]
  111. }
  112. ]