ctags.rb 1.0.0 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +2 -1
- data/README.md +49 -0
- data/Rakefile +19 -0
- data/bench.rb +28 -0
- data/ctags.rb.gemspec +1 -1
- data/ext/.gitignore +1 -1
- data/ext/extconf.rb +30 -6
- data/ext/vendor/exuberant-ctags/entry.c +70 -1
- data/ext/vendor/exuberant-ctags/main.c +68 -7
- data/ext/vendor/exuberant-ctags/options.c +12 -12
- data/ext/vendor/exuberant-ctags/options.h +1 -1
- data/ext/vendor/exuberant-ctags/parse.c +2 -2
- data/ext/vendor/exuberant-ctags/read.c +8 -3
- data/ext/vendor/exuberant-ctags/read.h +4 -1
- data/ext/vendor/exuberant-ctags/routines.c +31 -8
- data/ext/vendor/exuberant-ctags/ruby.c +62 -7
- data/ext/vendor/fmemopen/README.md +49 -0
- data/ext/vendor/fmemopen/fmemopen.c +92 -0
- data/ext/vendor/fmemopen/fmemopen.h +52 -0
- data/ext/vendor/jansson-2.5/CHANGES +554 -0
- data/ext/vendor/jansson-2.5/LICENSE +19 -0
- data/ext/vendor/jansson-2.5/Makefile.am +15 -0
- data/ext/vendor/jansson-2.5/Makefile.in +825 -0
- data/ext/vendor/jansson-2.5/README.rst +63 -0
- data/ext/vendor/jansson-2.5/aclocal.m4 +9674 -0
- data/ext/vendor/jansson-2.5/config.guess +1530 -0
- data/ext/vendor/jansson-2.5/config.h.in +84 -0
- data/ext/vendor/jansson-2.5/config.sub +1782 -0
- data/ext/vendor/jansson-2.5/configure +13931 -0
- data/ext/vendor/jansson-2.5/configure.ac +57 -0
- data/ext/vendor/jansson-2.5/depcomp +708 -0
- data/ext/vendor/jansson-2.5/doc/Makefile.am +20 -0
- data/ext/vendor/jansson-2.5/doc/Makefile.in +401 -0
- data/ext/vendor/jansson-2.5/doc/README +5 -0
- data/ext/vendor/jansson-2.5/doc/apiref.rst +1487 -0
- data/ext/vendor/jansson-2.5/doc/changes.rst +5 -0
- data/ext/vendor/jansson-2.5/doc/conf.py +217 -0
- data/ext/vendor/jansson-2.5/doc/conformance.rst +114 -0
- data/ext/vendor/jansson-2.5/doc/ext/refcounting.py +59 -0
- data/ext/vendor/jansson-2.5/doc/gettingstarted.rst +237 -0
- data/ext/vendor/jansson-2.5/doc/github_commits.c +192 -0
- data/ext/vendor/jansson-2.5/doc/index.rst +53 -0
- data/ext/vendor/jansson-2.5/doc/portability.rst +52 -0
- data/ext/vendor/jansson-2.5/doc/tutorial.rst +286 -0
- data/ext/vendor/jansson-2.5/doc/upgrading.rst +76 -0
- data/ext/vendor/jansson-2.5/install-sh +527 -0
- data/ext/vendor/jansson-2.5/jansson.pc.in +10 -0
- data/ext/vendor/jansson-2.5/ltmain.sh +9661 -0
- data/ext/vendor/jansson-2.5/missing +331 -0
- data/ext/vendor/jansson-2.5/src/Makefile.am +24 -0
- data/ext/vendor/jansson-2.5/src/Makefile.in +613 -0
- data/ext/vendor/jansson-2.5/src/dump.c +456 -0
- data/ext/vendor/jansson-2.5/src/error.c +63 -0
- data/ext/vendor/jansson-2.5/src/hashtable.c +360 -0
- data/ext/vendor/jansson-2.5/src/hashtable.h +180 -0
- data/ext/vendor/jansson-2.5/src/jansson.def +63 -0
- data/ext/vendor/jansson-2.5/src/jansson.h +281 -0
- data/ext/vendor/jansson-2.5/src/jansson_config.h +39 -0
- data/ext/vendor/jansson-2.5/src/jansson_config.h.in +39 -0
- data/ext/vendor/jansson-2.5/src/jansson_private.h +93 -0
- data/ext/vendor/jansson-2.5/src/load.c +1077 -0
- data/ext/vendor/jansson-2.5/src/memory.c +56 -0
- data/ext/vendor/jansson-2.5/src/pack_unpack.c +762 -0
- data/ext/vendor/jansson-2.5/src/strbuffer.c +116 -0
- data/ext/vendor/jansson-2.5/src/strbuffer.h +33 -0
- data/ext/vendor/jansson-2.5/src/strconv.c +134 -0
- data/ext/vendor/jansson-2.5/src/utf.c +190 -0
- data/ext/vendor/jansson-2.5/src/utf.h +39 -0
- data/ext/vendor/jansson-2.5/src/value.c +950 -0
- data/ext/vendor/jansson-2.5/test/Makefile.am +10 -0
- data/ext/vendor/jansson-2.5/test/Makefile.in +684 -0
- data/ext/vendor/jansson-2.5/test/bin/Makefile.am +5 -0
- data/ext/vendor/jansson-2.5/test/bin/Makefile.in +498 -0
- data/ext/vendor/jansson-2.5/test/bin/json_process.c +349 -0
- data/ext/vendor/jansson-2.5/test/run-suites +50 -0
- data/ext/vendor/jansson-2.5/test/scripts/run-tests.sh +100 -0
- data/ext/vendor/jansson-2.5/test/scripts/valgrind.sh +35 -0
- data/ext/vendor/jansson-2.5/test/suites/Makefile.am +2 -0
- data/ext/vendor/jansson-2.5/test/suites/Makefile.in +580 -0
- data/ext/vendor/jansson-2.5/test/suites/api/Makefile.am +34 -0
- data/ext/vendor/jansson-2.5/test/suites/api/Makefile.in +632 -0
- data/ext/vendor/jansson-2.5/test/suites/api/check-exports +23 -0
- data/ext/vendor/jansson-2.5/test/suites/api/run +36 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_array.c +432 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_copy.c +318 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_dump.c +190 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_dump_callback.c +81 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_equal.c +189 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_load.c +166 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_load_callback.c +75 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_loadb.c +36 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_memory_funcs.c +82 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_number.c +73 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_object.c +511 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_pack.c +283 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_simple.c +199 -0
- data/ext/vendor/jansson-2.5/test/suites/api/test_unpack.c +373 -0
- data/ext/vendor/jansson-2.5/test/suites/api/util.h +74 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/encoded-surrogate-half/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/encoded-surrogate-half/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-array/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-escape/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-escape/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-int/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-int/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-string/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/invalid-utf-8-in-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-invalid-utf-8/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-invalid-utf-8/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/not-in-unicode-range/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/not-in-unicode-range/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-3-byte-encoding/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-3-byte-encoding/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-4-byte-encoding/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-4-byte-encoding/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-ascii-encoding/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/overlong-ascii-encoding/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/restricted-utf-8/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/restricted-utf-8/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/run +27 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/truncated-utf-8/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid-unicode/truncated-utf-8/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/apostrophe/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/apostrophe/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/ascii-unicode-identifier/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/ascii-unicode-identifier/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/brace-comma/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/brace-comma/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-comma/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-comma/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-one-comma/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-one-comma/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/bracket-one-comma/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/empty/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/empty/input +0 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/escaped-null-byte-in-string/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/escaped-null-byte-in-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-array/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-multiline-array/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/extra-comma-in-multiline-array/input +6 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-after-newline/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-after-newline/input +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-at-the-end/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/garbage-at-the-end/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/integer-starting-with-zero/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/integer-starting-with-zero/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-escape/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-escape/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-identifier/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-identifier/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-integer/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-integer/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-real/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-negative-real/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-second-surrogate/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/invalid-second-surrogate/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-brace/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-brace/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-brace/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-bracket/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-bracket/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-open-bracket/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-second-surrogate/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/lone-second-surrogate/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/minus-sign-without-number/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/minus-sign-without-number/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/negative-integer-starting-with-zero/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/negative-integer-starting-with-zero/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-in-string/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-in-string/input +0 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-in-string/nostrip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-outside-string/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-outside-string/input +0 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null-byte-outside-string/nostrip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/null/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-apostrophes/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-apostrophes/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-garbage-at-end/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-garbage-at-end/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-in-unterminated-array/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-in-unterminated-array/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-in-unterminated-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-colon/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-colon/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-colon/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-value/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-value/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-no-value/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-unterminated-value/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-unterminated-value/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/object-unterminated-value/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-garbage-after-e/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-garbage-after-e/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-negative-overflow/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-negative-overflow/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-positive-overflow/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-positive-overflow/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-e/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-e/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-point/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/real-truncated-at-point/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/run +57 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/tab-character-in-string/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/tab-character-in-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-negative-integer/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-negative-integer/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-positive-integer/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/too-big-positive-integer/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/truncated-unicode-surrogate/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/truncated-unicode-surrogate/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unicode-identifier/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unicode-identifier/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array-and-object/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array-and-object/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array-and-object/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-empty-key/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-empty-key/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-empty-key/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-key/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-key/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-key/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-object-and-array/error +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-object-and-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-string/error.normal +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-string/error.strip +2 -0
- data/ext/vendor/jansson-2.5/test/suites/invalid/unterminated-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/complex-array/env +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/complex-array/input +5 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/complex-array/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-array/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-object-in-array/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-object-in-array/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-object/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-object/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/empty-string/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/escaped-utf-control-char/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/escaped-utf-control-char/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/false/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/false/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/negative-int/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/negative-int/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/negative-one/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/negative-one/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/negative-zero/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/negative-zero/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/null/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/null/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/one-byte-utf-8/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/one-byte-utf-8/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-negative-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-negative-exponent/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-positive-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e-positive-exponent/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-capital-e/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-exponent/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-fraction-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-fraction-exponent/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-negative-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-negative-exponent/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-positive-exponent/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-positive-exponent/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-underflow/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/real-underflow/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/run +56 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/short-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/short-string/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-ascii-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-ascii-string/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-0/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-0/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-1/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-1/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-123/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-int-123/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-object/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-object/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-real/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/simple-real/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/string-escapes/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/string-escapes/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/three-byte-utf-8/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/three-byte-utf-8/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/true/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/true/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/two-byte-utf-8/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/two-byte-utf-8/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/utf-8-string/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/utf-8-string/output +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/utf-surrogate-four-byte-encoding/input +1 -0
- data/ext/vendor/jansson-2.5/test/suites/valid/utf-surrogate-four-byte-encoding/output +1 -0
- data/ext/vendor/jansson-2.5/win32/jansson_config.h +39 -0
- data/ext/vendor/jansson-2.5/win32/vs2010/jansson.sln +20 -0
- data/ext/vendor/jansson-2.5/win32/vs2010/jansson.vcxproj +108 -0
- data/ext/vendor/jansson-2.5/win32/vs2010/jansson.vcxproj.filters +69 -0
- data/ext/vendor/jansson-2.5/win32/vs2010/jansson.vcxproj.user +3 -0
- data/lib/ctags.cnf +2 -0
- data/lib/ctags/exuberant.rb +129 -17
- data/lib/ctags/version.rb +1 -1
- data/test/test_ctags.rb +14 -7
- metadata +350 -69
@@ -0,0 +1,81 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
3
|
+
*
|
4
|
+
* Jansson is free software; you can redistribute it and/or modify
|
5
|
+
* it under the terms of the MIT license. See LICENSE for details.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include <jansson.h>
|
9
|
+
#include <string.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include "util.h"
|
12
|
+
|
13
|
+
struct my_sink {
|
14
|
+
char *buf;
|
15
|
+
size_t off;
|
16
|
+
size_t cap;
|
17
|
+
};
|
18
|
+
|
19
|
+
static int my_writer(const char *buffer, size_t len, void *data) {
|
20
|
+
struct my_sink *s = data;
|
21
|
+
if (len > s->cap - s->off) {
|
22
|
+
return -1;
|
23
|
+
}
|
24
|
+
memcpy(s->buf + s->off, buffer, len);
|
25
|
+
s->off += len;
|
26
|
+
return 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
static void run_tests()
|
30
|
+
{
|
31
|
+
struct my_sink s;
|
32
|
+
json_t *json;
|
33
|
+
const char str[] = "[\"A\", {\"B\": \"C\", \"e\": false}, 1, null, \"foo\"]";
|
34
|
+
char *dumped_to_string;
|
35
|
+
|
36
|
+
json = json_loads(str, 0, NULL);
|
37
|
+
if(!json) {
|
38
|
+
fail("json_loads failed");
|
39
|
+
}
|
40
|
+
|
41
|
+
dumped_to_string = json_dumps(json, 0);
|
42
|
+
if (!dumped_to_string) {
|
43
|
+
json_decref(json);
|
44
|
+
fail("json_dumps failed");
|
45
|
+
}
|
46
|
+
|
47
|
+
s.off = 0;
|
48
|
+
s.cap = strlen(dumped_to_string);
|
49
|
+
s.buf = malloc(s.cap);
|
50
|
+
if (!s.buf) {
|
51
|
+
json_decref(json);
|
52
|
+
free(dumped_to_string);
|
53
|
+
fail("malloc failed");
|
54
|
+
}
|
55
|
+
|
56
|
+
if (json_dump_callback(json, my_writer, &s, 0) == -1) {
|
57
|
+
json_decref(json);
|
58
|
+
free(dumped_to_string);
|
59
|
+
free(s.buf);
|
60
|
+
fail("json_dump_callback failed on an exact-length sink buffer");
|
61
|
+
}
|
62
|
+
|
63
|
+
if (strncmp(dumped_to_string, s.buf, s.off) != 0) {
|
64
|
+
json_decref(json);
|
65
|
+
free(dumped_to_string);
|
66
|
+
free(s.buf);
|
67
|
+
fail("json_dump_callback and json_dumps did not produce identical output");
|
68
|
+
}
|
69
|
+
|
70
|
+
s.off = 1;
|
71
|
+
if (json_dump_callback(json, my_writer, &s, 0) != -1) {
|
72
|
+
json_decref(json);
|
73
|
+
free(dumped_to_string);
|
74
|
+
free(s.buf);
|
75
|
+
fail("json_dump_callback succeeded on a short buffer when it should have failed");
|
76
|
+
}
|
77
|
+
|
78
|
+
json_decref(json);
|
79
|
+
free(dumped_to_string);
|
80
|
+
free(s.buf);
|
81
|
+
}
|
@@ -0,0 +1,189 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
3
|
+
*
|
4
|
+
* Jansson is free software; you can redistribute it and/or modify
|
5
|
+
* it under the terms of the MIT license. See LICENSE for details.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include <jansson.h>
|
9
|
+
#include "util.h"
|
10
|
+
|
11
|
+
static void test_equal_simple()
|
12
|
+
{
|
13
|
+
json_t *value1, *value2;
|
14
|
+
|
15
|
+
if(json_equal(NULL, NULL))
|
16
|
+
fail("json_equal fails for two NULLs");
|
17
|
+
|
18
|
+
value1 = json_true();
|
19
|
+
if(json_equal(value1, NULL) || json_equal(NULL, value1))
|
20
|
+
fail("json_equal fails for NULL");
|
21
|
+
|
22
|
+
/* this covers true, false and null as they are singletons */
|
23
|
+
if(!json_equal(value1, value1))
|
24
|
+
fail("identical objects are not equal");
|
25
|
+
json_decref(value1);
|
26
|
+
|
27
|
+
/* integer */
|
28
|
+
value1 = json_integer(1);
|
29
|
+
value2 = json_integer(1);
|
30
|
+
if(!value1 || !value2)
|
31
|
+
fail("unable to create integers");
|
32
|
+
if(!json_equal(value1, value2))
|
33
|
+
fail("json_equal fails for two equal integers");
|
34
|
+
json_decref(value2);
|
35
|
+
|
36
|
+
value2 = json_integer(2);
|
37
|
+
if(!value2)
|
38
|
+
fail("unable to create an integer");
|
39
|
+
if(json_equal(value1, value2))
|
40
|
+
fail("json_equal fails for two inequal integers");
|
41
|
+
|
42
|
+
json_decref(value1);
|
43
|
+
json_decref(value2);
|
44
|
+
|
45
|
+
/* real */
|
46
|
+
value1 = json_real(1.2);
|
47
|
+
value2 = json_real(1.2);
|
48
|
+
if(!value1 || !value2)
|
49
|
+
fail("unable to create reals");
|
50
|
+
if(!json_equal(value1, value2))
|
51
|
+
fail("json_equal fails for two equal reals");
|
52
|
+
json_decref(value2);
|
53
|
+
|
54
|
+
value2 = json_real(3.141592);
|
55
|
+
if(!value2)
|
56
|
+
fail("unable to create an real");
|
57
|
+
if(json_equal(value1, value2))
|
58
|
+
fail("json_equal fails for two inequal reals");
|
59
|
+
|
60
|
+
json_decref(value1);
|
61
|
+
json_decref(value2);
|
62
|
+
|
63
|
+
/* string */
|
64
|
+
value1 = json_string("foo");
|
65
|
+
value2 = json_string("foo");
|
66
|
+
if(!value1 || !value2)
|
67
|
+
fail("unable to create strings");
|
68
|
+
if(!json_equal(value1, value2))
|
69
|
+
fail("json_equal fails for two equal strings");
|
70
|
+
json_decref(value2);
|
71
|
+
|
72
|
+
value2 = json_string("bar");
|
73
|
+
if(!value2)
|
74
|
+
fail("unable to create an string");
|
75
|
+
if(json_equal(value1, value2))
|
76
|
+
fail("json_equal fails for two inequal strings");
|
77
|
+
|
78
|
+
json_decref(value1);
|
79
|
+
json_decref(value2);
|
80
|
+
}
|
81
|
+
|
82
|
+
static void test_equal_array()
|
83
|
+
{
|
84
|
+
json_t *array1, *array2;
|
85
|
+
|
86
|
+
array1 = json_array();
|
87
|
+
array2 = json_array();
|
88
|
+
if(!array1 || !array2)
|
89
|
+
fail("unable to create arrays");
|
90
|
+
|
91
|
+
if(!json_equal(array1, array2))
|
92
|
+
fail("json_equal fails for two empty arrays");
|
93
|
+
|
94
|
+
json_array_append_new(array1, json_integer(1));
|
95
|
+
json_array_append_new(array2, json_integer(1));
|
96
|
+
json_array_append_new(array1, json_string("foo"));
|
97
|
+
json_array_append_new(array2, json_string("foo"));
|
98
|
+
json_array_append_new(array1, json_integer(2));
|
99
|
+
json_array_append_new(array2, json_integer(2));
|
100
|
+
if(!json_equal(array1, array2))
|
101
|
+
fail("json_equal fails for two equal arrays");
|
102
|
+
|
103
|
+
json_array_remove(array2, 2);
|
104
|
+
if(json_equal(array1, array2))
|
105
|
+
fail("json_equal fails for two inequal arrays");
|
106
|
+
|
107
|
+
json_array_append_new(array2, json_integer(3));
|
108
|
+
if(json_equal(array1, array2))
|
109
|
+
fail("json_equal fails for two inequal arrays");
|
110
|
+
|
111
|
+
json_decref(array1);
|
112
|
+
json_decref(array2);
|
113
|
+
}
|
114
|
+
|
115
|
+
static void test_equal_object()
|
116
|
+
{
|
117
|
+
json_t *object1, *object2;
|
118
|
+
|
119
|
+
object1 = json_object();
|
120
|
+
object2 = json_object();
|
121
|
+
if(!object1 || !object2)
|
122
|
+
fail("unable to create objects");
|
123
|
+
|
124
|
+
if(!json_equal(object1, object2))
|
125
|
+
fail("json_equal fails for two empty objects");
|
126
|
+
|
127
|
+
json_object_set_new(object1, "a", json_integer(1));
|
128
|
+
json_object_set_new(object2, "a", json_integer(1));
|
129
|
+
json_object_set_new(object1, "b", json_string("foo"));
|
130
|
+
json_object_set_new(object2, "b", json_string("foo"));
|
131
|
+
json_object_set_new(object1, "c", json_integer(2));
|
132
|
+
json_object_set_new(object2, "c", json_integer(2));
|
133
|
+
if(!json_equal(object1, object2))
|
134
|
+
fail("json_equal fails for two equal objects");
|
135
|
+
|
136
|
+
json_object_del(object2, "c");
|
137
|
+
if(json_equal(object1, object2))
|
138
|
+
fail("json_equal fails for two inequal objects");
|
139
|
+
|
140
|
+
json_object_set_new(object2, "c", json_integer(3));
|
141
|
+
if(json_equal(object1, object2))
|
142
|
+
fail("json_equal fails for two inequal objects");
|
143
|
+
|
144
|
+
json_object_del(object2, "c");
|
145
|
+
json_object_set_new(object2, "d", json_integer(2));
|
146
|
+
if(json_equal(object1, object2))
|
147
|
+
fail("json_equal fails for two inequal objects");
|
148
|
+
|
149
|
+
json_decref(object1);
|
150
|
+
json_decref(object2);
|
151
|
+
}
|
152
|
+
|
153
|
+
static void test_equal_complex()
|
154
|
+
{
|
155
|
+
json_t *value1, *value2;
|
156
|
+
|
157
|
+
const char *complex_json =
|
158
|
+
"{"
|
159
|
+
" \"integer\": 1, "
|
160
|
+
" \"real\": 3.141592, "
|
161
|
+
" \"string\": \"foobar\", "
|
162
|
+
" \"true\": true, "
|
163
|
+
" \"object\": {"
|
164
|
+
" \"array-in-object\": [1,true,\"foo\",{}],"
|
165
|
+
" \"object-in-object\": {\"foo\": \"bar\"}"
|
166
|
+
" },"
|
167
|
+
" \"array\": [\"foo\", false, null, 1.234]"
|
168
|
+
"}";
|
169
|
+
|
170
|
+
value1 = json_loads(complex_json, 0, NULL);
|
171
|
+
value2 = json_loads(complex_json, 0, NULL);
|
172
|
+
if(!value1 || !value2)
|
173
|
+
fail("unable to parse JSON");
|
174
|
+
if(!json_equal(value1, value2))
|
175
|
+
fail("json_equal fails for two inequal strings");
|
176
|
+
|
177
|
+
json_decref(value1);
|
178
|
+
json_decref(value2);
|
179
|
+
|
180
|
+
/* TODO: There's no negative test case here */
|
181
|
+
}
|
182
|
+
|
183
|
+
static void run_tests()
|
184
|
+
{
|
185
|
+
test_equal_simple();
|
186
|
+
test_equal_array();
|
187
|
+
test_equal_object();
|
188
|
+
test_equal_complex();
|
189
|
+
}
|
@@ -0,0 +1,166 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009-2013 Petri Lehtinen <petri@digip.org>
|
3
|
+
*
|
4
|
+
* Jansson is free software; you can redistribute it and/or modify
|
5
|
+
* it under the terms of the MIT license. See LICENSE for details.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include <jansson.h>
|
9
|
+
#include <string.h>
|
10
|
+
#include "util.h"
|
11
|
+
|
12
|
+
static void file_not_found()
|
13
|
+
{
|
14
|
+
json_t *json;
|
15
|
+
json_error_t error;
|
16
|
+
char *pos;
|
17
|
+
|
18
|
+
json = json_load_file("/path/to/nonexistent/file.json", 0, &error);
|
19
|
+
if(json)
|
20
|
+
fail("json_load_file returned non-NULL for a nonexistent file");
|
21
|
+
if(error.line != -1)
|
22
|
+
fail("json_load_file returned an invalid line number");
|
23
|
+
|
24
|
+
/* The error message is locale specific, only check the beginning
|
25
|
+
of the error message. */
|
26
|
+
|
27
|
+
pos = strchr(error.text, ':');
|
28
|
+
if(!pos)
|
29
|
+
fail("json_load_file returne an invalid error message");
|
30
|
+
|
31
|
+
*pos = '\0';
|
32
|
+
|
33
|
+
if(strcmp(error.text, "unable to open /path/to/nonexistent/file.json") != 0)
|
34
|
+
fail("json_load_file returned an invalid error message");
|
35
|
+
}
|
36
|
+
|
37
|
+
static void reject_duplicates()
|
38
|
+
{
|
39
|
+
json_error_t error;
|
40
|
+
|
41
|
+
if(json_loads("{\"foo\": 1, \"foo\": 2}", JSON_REJECT_DUPLICATES, &error))
|
42
|
+
fail("json_loads did not detect a duplicate key");
|
43
|
+
check_error("duplicate object key near '\"foo\"'", "<string>", 1, 16, 16);
|
44
|
+
}
|
45
|
+
|
46
|
+
static void disable_eof_check()
|
47
|
+
{
|
48
|
+
json_error_t error;
|
49
|
+
json_t *json;
|
50
|
+
|
51
|
+
const char *text = "{\"foo\": 1} garbage";
|
52
|
+
|
53
|
+
if(json_loads(text, 0, &error))
|
54
|
+
fail("json_loads did not detect garbage after JSON text");
|
55
|
+
check_error("end of file expected near 'garbage'", "<string>", 1, 18, 18);
|
56
|
+
|
57
|
+
json = json_loads(text, JSON_DISABLE_EOF_CHECK, &error);
|
58
|
+
if(!json)
|
59
|
+
fail("json_loads failed with JSON_DISABLE_EOF_CHECK");
|
60
|
+
|
61
|
+
json_decref(json);
|
62
|
+
}
|
63
|
+
|
64
|
+
static void decode_any()
|
65
|
+
{
|
66
|
+
json_t *json;
|
67
|
+
json_error_t error;
|
68
|
+
|
69
|
+
json = json_loads("\"foo\"", JSON_DECODE_ANY, &error);
|
70
|
+
if (!json || !json_is_string(json))
|
71
|
+
fail("json_load decoded any failed - string");
|
72
|
+
json_decref(json);
|
73
|
+
|
74
|
+
json = json_loads("42", JSON_DECODE_ANY, &error);
|
75
|
+
if (!json || !json_is_integer(json))
|
76
|
+
fail("json_load decoded any failed - integer");
|
77
|
+
json_decref(json);
|
78
|
+
|
79
|
+
json = json_loads("true", JSON_DECODE_ANY, &error);
|
80
|
+
if (!json || !json_is_true(json))
|
81
|
+
fail("json_load decoded any failed - boolean");
|
82
|
+
json_decref(json);
|
83
|
+
|
84
|
+
json = json_loads("null", JSON_DECODE_ANY, &error);
|
85
|
+
if (!json || !json_is_null(json))
|
86
|
+
fail("json_load decoded any failed - null");
|
87
|
+
json_decref(json);
|
88
|
+
}
|
89
|
+
|
90
|
+
static void decode_int_as_real()
|
91
|
+
{
|
92
|
+
json_t *json;
|
93
|
+
json_error_t error;
|
94
|
+
|
95
|
+
#if JSON_INTEGER_IS_LONG_LONG
|
96
|
+
const char *imprecise;
|
97
|
+
json_int_t expected;
|
98
|
+
#endif
|
99
|
+
|
100
|
+
json = json_loads("42", JSON_DECODE_INT_AS_REAL | JSON_DECODE_ANY, &error);
|
101
|
+
if (!json || !json_is_real(json) || json_real_value(json) != 42.0)
|
102
|
+
fail("json_load decode int as real failed - int");
|
103
|
+
json_decref(json);
|
104
|
+
|
105
|
+
#if JSON_INTEGER_IS_LONG_LONG
|
106
|
+
/* This number cannot be represented exactly by a double */
|
107
|
+
imprecise = "9007199254740993";
|
108
|
+
expected = 9007199254740992ll;
|
109
|
+
|
110
|
+
json = json_loads(imprecise, JSON_DECODE_INT_AS_REAL | JSON_DECODE_ANY,
|
111
|
+
&error);
|
112
|
+
if (!json || !json_is_real(json) || expected != (json_int_t)json_real_value(json))
|
113
|
+
fail("json_load decode int as real failed - expected imprecision");
|
114
|
+
json_decref(json);
|
115
|
+
#endif
|
116
|
+
}
|
117
|
+
|
118
|
+
static void load_wrong_args()
|
119
|
+
{
|
120
|
+
json_t *json;
|
121
|
+
json_error_t error;
|
122
|
+
|
123
|
+
json = json_loads(NULL, 0, &error);
|
124
|
+
if (json)
|
125
|
+
fail("json_loads should return NULL if the first argument is NULL");
|
126
|
+
|
127
|
+
json = json_loadb(NULL, 0, 0, &error);
|
128
|
+
if (json)
|
129
|
+
fail("json_loadb should return NULL if the first argument is NULL");
|
130
|
+
|
131
|
+
json = json_loadf(NULL, 0, &error);
|
132
|
+
if (json)
|
133
|
+
fail("json_loadf should return NULL if the first argument is NULL");
|
134
|
+
|
135
|
+
json = json_load_file(NULL, 0, &error);
|
136
|
+
if (json)
|
137
|
+
fail("json_loadf should return NULL if the first argument is NULL");
|
138
|
+
}
|
139
|
+
|
140
|
+
static void position()
|
141
|
+
{
|
142
|
+
json_t *json;
|
143
|
+
size_t flags = JSON_DISABLE_EOF_CHECK;
|
144
|
+
json_error_t error;
|
145
|
+
|
146
|
+
json = json_loads("{\"foo\": \"bar\"}", 0, &error);
|
147
|
+
if(error.position != 14)
|
148
|
+
fail("json_loads returned a wrong position");
|
149
|
+
json_decref(json);
|
150
|
+
|
151
|
+
json = json_loads("{\"foo\": \"bar\"} baz quux", flags, &error);
|
152
|
+
if(error.position != 14)
|
153
|
+
fail("json_loads returned a wrong position");
|
154
|
+
json_decref(json);
|
155
|
+
}
|
156
|
+
|
157
|
+
static void run_tests()
|
158
|
+
{
|
159
|
+
file_not_found();
|
160
|
+
reject_duplicates();
|
161
|
+
disable_eof_check();
|
162
|
+
decode_any();
|
163
|
+
decode_int_as_real();
|
164
|
+
load_wrong_args();
|
165
|
+
position();
|
166
|
+
}
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009-2011 Petri Lehtinen <petri@digip.org>
|
3
|
+
*
|
4
|
+
* Jansson is free software; you can redistribute it and/or modify
|
5
|
+
* it under the terms of the MIT license. See LICENSE for details.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include <jansson.h>
|
9
|
+
#include <string.h>
|
10
|
+
#include <stdlib.h>
|
11
|
+
#include "util.h"
|
12
|
+
|
13
|
+
struct my_source {
|
14
|
+
const char *buf;
|
15
|
+
size_t off;
|
16
|
+
size_t cap;
|
17
|
+
};
|
18
|
+
|
19
|
+
static const char my_str[] = "[\"A\", {\"B\": \"C\", \"e\": false}, 1, null, \"foo\"]";
|
20
|
+
|
21
|
+
static size_t greedy_reader(void *buf, size_t buflen, void *arg)
|
22
|
+
{
|
23
|
+
struct my_source *s = arg;
|
24
|
+
if (buflen > s->cap - s->off)
|
25
|
+
buflen = s->cap - s->off;
|
26
|
+
if (buflen > 0) {
|
27
|
+
memcpy(buf, s->buf + s->off, buflen);
|
28
|
+
s->off += buflen;
|
29
|
+
return buflen;
|
30
|
+
} else {
|
31
|
+
return 0;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
|
35
|
+
static void run_tests()
|
36
|
+
{
|
37
|
+
struct my_source s;
|
38
|
+
json_t *json;
|
39
|
+
json_error_t error;
|
40
|
+
|
41
|
+
s.off = 0;
|
42
|
+
s.cap = strlen(my_str);
|
43
|
+
s.buf = my_str;
|
44
|
+
|
45
|
+
json = json_load_callback(greedy_reader, &s, 0, &error);
|
46
|
+
|
47
|
+
if (!json)
|
48
|
+
fail("json_load_callback failed on a valid callback");
|
49
|
+
json_decref(json);
|
50
|
+
|
51
|
+
s.off = 0;
|
52
|
+
s.cap = strlen(my_str) - 1;
|
53
|
+
s.buf = my_str;
|
54
|
+
|
55
|
+
json = json_load_callback(greedy_reader, &s, 0, &error);
|
56
|
+
if (json) {
|
57
|
+
json_decref(json);
|
58
|
+
fail("json_load_callback should have failed on an incomplete stream, but it didn't");
|
59
|
+
}
|
60
|
+
if (strcmp(error.source, "<callback>") != 0) {
|
61
|
+
fail("json_load_callback returned an invalid error source");
|
62
|
+
}
|
63
|
+
if (strcmp(error.text, "']' expected near end of file") != 0) {
|
64
|
+
fail("json_load_callback returned an invalid error message for an unclosed top-level array");
|
65
|
+
}
|
66
|
+
|
67
|
+
json = json_load_callback(NULL, NULL, 0, &error);
|
68
|
+
if (json) {
|
69
|
+
json_decref(json);
|
70
|
+
fail("json_load_callback should have failed on NULL load callback, but it didn't");
|
71
|
+
}
|
72
|
+
if (strcmp(error.text, "wrong arguments") != 0) {
|
73
|
+
fail("json_load_callback returned an invalid error message for a NULL load callback");
|
74
|
+
}
|
75
|
+
}
|