From b2047704ad359447958203810784f4e2f3deeff5 Mon Sep 17 00:00:00 2001
From: Howard Li <bighorn@pursuitofchallenge.com>
Date: 周三, 29 4月 2020 03:23:49 +0800
Subject: [PATCH] Avoid directly clearing STB

---
 libscpi/test/test_parser.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/libscpi/test/test_parser.c b/libscpi/test/test_parser.c
index 76e8008..1ea9543 100644
--- a/libscpi/test/test_parser.c
+++ b/libscpi/test/test_parser.c
@@ -150,7 +150,7 @@
     err_buffer_pos = 0;
 
     SCPI_RegClearBits(&scpi_context, SCPI_REG_STB, STB_QMA);
-    SCPI_EventClear(&scpi_context);
+    SCPI_RegSet(&scpi_context, SCPI_REG_ESR, 0);
     SCPI_ErrorClear(&scpi_context);
 }
 
@@ -265,6 +265,14 @@
     TEST_INPUT("\r\n", "MA,IN,0,VER\r\n");
     output_buffer_clear();
 
+    /* Test empty command at the beggining */
+    TEST_INPUT(";*IDN?\r\n", "MA,IN,0,VER\r\n");
+    output_buffer_clear();
+
+    TEST_INPUT(";", "");
+    TEST_INPUT("*IDN?\r\n", "MA,IN,0,VER\r\n");
+    output_buffer_clear();
+
     /* Test input "timeout" - input with length == 0 */
     TEST_INPUT("*IDN?", "");
     TEST_INPUT("", "MA,IN,0,VER\r\n");

--
Gitblit v1.9.1