diff --git a/jsonian-tests.el b/jsonian-tests.el index 87bac32..41922b5 100644 --- a/jsonian-tests.el +++ b/jsonian-tests.el @@ -174,6 +174,13 @@ We test that all lines are unchanged" '("fizz" 4 "some"))) (should (= (point) (point-min))))) +(ert-deftest jsonian-path-with-null () + (with-file-and-point "path-with-null" (point-min) + (should (equal + (jsonian-path nil 19) + '("b"))) + (should (= (point) (point-min))))) + (ert-deftest jsonian-simple-segment () "Check that we correctly identify simple segments." (mapc diff --git a/jsonian.el b/jsonian.el index f482866..5173d0d 100644 --- a/jsonian.el +++ b/jsonian.el @@ -180,6 +180,8 @@ Otherwise it will parse back to the beginning of the file." (jsonian--backward-true)) ;; Boolean literal: false ((eq (char-before) ?e) (jsonian--backward-false)) + ;; null literal + ((eq (char-before) ?l) (jsonian--backward-null)) ((bobp) (cl-return nil)) (t (user-error "`jsonian--path': Unexpected character '%s'" (if (bobp) "BOB" (format "%c" (char-before))))))))) @@ -420,6 +422,7 @@ and ARG2." (jsonian--defun-traverse "true") (jsonian--defun-traverse "false") +(jsonian--defun-traverse "null") (jsonian--defun-traverse whitespace (x) (or (= x ?\ ) diff --git a/test-assets/path-with-null.json b/test-assets/path-with-null.json new file mode 100644 index 0000000..a058f3d --- /dev/null +++ b/test-assets/path-with-null.json @@ -0,0 +1,4 @@ +{ + "a": null, + "b": true +}