equal
deleted
inserted
replaced
685 _st->print_cr("%s", line_start); |
685 _st->print_cr("%s", line_start); |
686 } |
686 } |
687 } |
687 } |
688 |
688 |
689 #ifndef PRODUCT |
689 #ifndef PRODUCT |
|
690 class JSONTest : public JSON { |
|
691 public: |
|
692 static void test(); |
|
693 |
|
694 private: |
|
695 JSONTest(const char* text); |
|
696 static void test(const char* json, bool valid); |
|
697 |
|
698 void log(uint level, const char* format, ...) ATTRIBUTE_PRINTF(3, 4); |
|
699 |
|
700 bool callback(JSON_TYPE t, JSON_VAL* v, uint level); |
|
701 JSON_TYPE prev; |
|
702 }; |
|
703 |
|
704 void JSON_test() { |
|
705 JSONTest::test(); |
|
706 } |
|
707 |
690 void JSONTest::test(const char* text, bool should_pass) { |
708 void JSONTest::test(const char* text, bool should_pass) { |
691 JSONTest json(text); |
709 JSONTest json(text); |
692 if (should_pass) { |
710 if (should_pass) { |
693 assert(json.valid() == true, "failed on a valid json string"); |
711 assert(json.valid() == true, "failed on a valid json string"); |
694 if (VerboseInternalVMTests) { |
712 if (VerboseInternalVMTests) { |
705 JSONTest::JSONTest(const char* text) : JSON(text, !VerboseInternalVMTests, tty) { |
723 JSONTest::JSONTest(const char* text) : JSON(text, !VerboseInternalVMTests, tty) { |
706 prev = JSON_NONE; |
724 prev = JSON_NONE; |
707 parse(); |
725 parse(); |
708 } |
726 } |
709 |
727 |
710 bool JSONTest::test() { |
728 void JSONTest::test() { |
711 JSONTest::test("{}", true); |
729 JSONTest::test("{}", true); |
712 JSONTest::test("[]", true); |
730 JSONTest::test("[]", true); |
713 JSONTest::test(" { } ", true); |
731 JSONTest::test(" { } ", true); |
714 JSONTest::test(" [ ] ", true); |
732 JSONTest::test(" [ ] ", true); |
715 |
733 |
840 "" "\n" |
858 "" "\n" |
841 " // force matching compiles to be blocking/syncronous" "\n" |
859 " // force matching compiles to be blocking/syncronous" "\n" |
842 " blocking_compile: true" "\n" |
860 " blocking_compile: true" "\n" |
843 " }," "\n" |
861 " }," "\n" |
844 "]" "\n", true); |
862 "]" "\n", true); |
845 |
|
846 return true; |
|
847 } |
863 } |
848 |
864 |
849 void JSONTest::log(uint indent, const char* format, ...) { |
865 void JSONTest::log(uint indent, const char* format, ...) { |
850 if (VerboseInternalVMTests) { |
866 if (VerboseInternalVMTests) { |
851 if (prev != JSON_KEY) { |
867 if (prev != JSON_KEY) { |