| 53 | } |
| 54 | |
| 55 | void TestMIParser::testParseLine_data() |
| 56 | { |
| 57 | QTest::addColumn<QByteArray>("line"); |
| 58 | QTest::addColumn<int>("recordKind"); |
| 59 | QTest::addColumn<QVariant>("recordData"); |
| 60 | |
| 61 | // prompt |
| 62 | QTest::newRow("gdpprompt") |
| 63 | << QByteArray("(gdb)") |
| 64 | << (int)KDevMI::MI::Record::Prompt |
| 65 | << QVariant(); |
| 66 | |
| 67 | // result records |
| 68 | QTest::newRow("done") |
| 69 | << QByteArray("^done") |
| 70 | << (int)KDevMI::MI::Record::Result |
| 71 | << ResultRecordData{0, "done", {}}.toVariant(); |
| 72 | QTest::newRow("doneWToken") |
| 73 | << QByteArray("11^done") |
| 74 | << (int)KDevMI::MI::Record::Result |
| 75 | << ResultRecordData{11, "done", {}}.toVariant(); |
| 76 | QTest::newRow("runningWToken") |
| 77 | << QByteArray("25^running") |
| 78 | << (int)KDevMI::MI::Record::Result |
| 79 | << ResultRecordData{25, "running", {}}.toVariant(); |
| 80 | |
| 81 | // Out-of-band records |
| 82 | QTest::newRow("stopreply") |
| 83 | << QByteArray("*stop,reason=\"stop\",address=\"0x123\",source=\"a.c:123\"") |
| 84 | << (int)KDevMI::MI::Record::Async |
| 85 | << AsyncRecordData{KDevMI::MI::AsyncRecord::Exec, "stop", |
| 86 | {{"reason", "stop"}, {"address", "0x123"}, {"source", "a.c:123"}}}.toVariant(); |
| 87 | QTest::newRow("threadgroupadded") |
| 88 | << QByteArray("=thread-group-added,id=\"i1\"") |
| 89 | << (int)KDevMI::MI::Record::Async |
| 90 | << AsyncRecordData{KDevMI::MI::AsyncRecord::Notify, "thread-group-added", |
| 91 | {{"id", "i1"}}}.toVariant(); |
| 92 | QTest::newRow("symbolfilereply") << QByteArray("*breakpoint,nr=\"3\",address=\"0x123\",source=\"a.c:123\"") |
| 93 | << (int)KDevMI::MI::Record::Async |
| 94 | << AsyncRecordData{KDevMI::MI::AsyncRecord::Exec, "breakpoint", |
| 95 | {{"nr", "3"}, {"address", "0x123"}, {"source", "a.c:123"}}}.toVariant(); |
| 96 | |
| 97 | // breakpoint creation records |
| 98 | QTest::newRow("breakreply") |
| 99 | << QByteArray("&\"break /path/to/some/file.cpp:28\\n\"") |
| 100 | << (int)KDevMI::MI::Record::Stream |
| 101 | << StreamRecordData{KDevMI::MI::StreamRecord::Log, "break /path/to/some/file.cpp:28\n"}.toVariant(); |
| 102 | QTest::newRow("breakreply2") |
| 103 | << QByteArray("~\"Breakpoint 1 at 0x400ab0: file /path/to/some/file.cpp, line 28.\\n\"") |
| 104 | << (int)KDevMI::MI::Record::Stream |
| 105 | << StreamRecordData{KDevMI::MI::StreamRecord::Console, "Breakpoint 1 at 0x400ab0: file /path/to/some/file.cpp, line 28.\n"}.toVariant(); |
| 106 | QTest::newRow("breakreply3") |
| 107 | << QByteArray("=breakpoint-created,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0x0000000000400ab0\",func=\"main(int, char**)\",file=\"/path/to/some/file.cpp\",fullname=\"/path/to/some/file.cpp\",line=\"28\",thread-groups=[\"i1\"],times=\"0\",original-location=\"/path/to/some/file.cpp:28\"}") |
| 108 | << (int)KDevMI::MI::Record::Async |
| 109 | << AsyncRecordData{KDevMI::MI::AsyncRecord::Notify, "breakpoint-created", |
| 110 | {{"bkpt", QVariantMap{ |
| 111 | {"number", "1"}, |
| 112 | {"type", "breakpoint"}, |
nothing calls this directly
no test coverage detected