JsonParserByLeo/Test/Err.mq5
2026-09-18 14:11:09 -05:00

47 lines
1.7 KiB
MQL5

//+------------------------------------------------------------------+
//| Err.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\Src\\JsonNode.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
TSN::CJsonParser parser;
//--- {
// Invalid JSON key, One of two errors: "Expected a ':' after a JSON key" or
// "Malformed JSON while searching for characters." [Line 1, Col 3]
parser.Assing("{");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
//--- [
// Invalid character find in json, finding valid value after '[' [Line 1, Col 3]
parser.Assing("[");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
//--- Unclosed key
// "Expected a ':' after a JSON key" or "Malformed JSON while searching for characters." [Line 1, Col 5]
parser.Assing("{\"a");
parser.CorrectPadding();
parser.Parse();
parser.ErrorInfo();
}
//+------------------------------------------------------------------+