From 2b7f9ad0a1f8d1b75e0f018a8c497ff9a651643c Mon Sep 17 00:00:00 2001
From: pompolic <pompolic@special-circumstanc.es>
Date: Tue, 28 Jun 2022 18:41:34 +0200
Subject: [PATCH] Progress towards unit tests

---
 gdb-port/tests/unit/ast.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gdb-port/tests/unit/ast.py b/gdb-port/tests/unit/ast.py
index 04fa5d4..77f2647 100644
--- a/gdb-port/tests/unit/ast.py
+++ b/gdb-port/tests/unit/ast.py
@@ -1,2 +1,26 @@
 import unittest
 import unittest.mock
+
+class HParseResultCreation(unittest.TestCase):
+	mocked_hparseresult = None
+
+	@classmethod
+	def setUpClass(cls):
+		hpt_patcher = unittest.mock.patch('__main__.HParsedToken', autospec=True)
+		gdbv_patcher = unittest.mock.patch('gdb.Value', autospec=True)
+		hpt_patcher.start()
+		gdbv_patcher.start()
+		mocked_hparseresult = HParseResult(0xdeadbeef)
+		gdbv_patcher.stop()
+		hpt_patcher.stop()
+
+	#def test_valid_address(self):
+	#	raise ValueError
+
+	def test_nullpointer(self):
+		with self.assertRaises(ValueError):
+			res = HParseResult(0)
+
+	#@patch("HParsedToken")
+	#def test_make_HParsedToken(self):
+	#	with patch.object(HParseResult, "read_member", return_value=0xdeadbeef):
-- 
GitLab