From: Andrea Righi Date: Tue, 5 Dec 2023 13:53:15 +0000 (+0100) Subject: tests: add an include test case X-Git-Tag: v0.2~12 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=9f818d9bfa280b3a8cc7636a34f496adcf72bee4;p=annotations.git tests: add an include test case Signed-off-by: Andrea Righi --- diff --git a/tests/data/annotations.derivative.1 b/tests/data/annotations.derivative.1 new file mode 100644 index 0000000..e72ac4c --- /dev/null +++ b/tests/data/annotations.derivative.1 @@ -0,0 +1,9 @@ +# Menu: HEADER +# FORMAT: 4 +# ARCH: amd64 armhf +# FLAVOUR: amd64-baz +# FLAVOUR_DEP: {"amd64-baz": "amd64-foo"} + +include "annotations.load.1" + +CONFIG_B_2 policy<{'amd64': '5'}> note diff --git a/tests/data/annotations.derivative.1.result b/tests/data/annotations.derivative.1.result new file mode 100644 index 0000000..d2bfdea --- /dev/null +++ b/tests/data/annotations.derivative.1.result @@ -0,0 +1,31 @@ +{ + "arch": [ + "amd64", + "armhf" + ], + "flavour": [ + "amd64-baz" + ], + "flavour_dep": { + "amd64-baz": "amd64-foo" + }, + "include": [ + "annotations.load.1" + ], + "config": { + "CONFIG_A_1": { + "policy": { + "amd64": "1", + "armhf": "1" + }, + "note": "'Config A_1'" + }, + "CONFIG_B_2": { + "policy": { + "amd64": "5", + "armhf": "2" + }, + "note": "'override Config B_2'" + } + } +} diff --git a/tests/test_derivative.py b/tests/test_derivative.py new file mode 100644 index 0000000..47ca5c0 --- /dev/null +++ b/tests/test_derivative.py @@ -0,0 +1,14 @@ +import unittest + +from tests import utils + +from kconfig.annotations import Annotation + + +class TestLoadAnnotations(unittest.TestCase): + def test_load(self): + for d in ("annotations.derivative.1",): + f = "tests/data/" + d + a = Annotation(f) + r = utils.load_json(f + ".result") + self.assertEqual(utils.to_dict(a), r)