From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- test cases/keyval/1 basic/.config | 3 +++ test cases/keyval/1 basic/meson.build | 18 ++++++++++++++++++ test cases/keyval/1 basic/test.json | 7 +++++++ test cases/keyval/2 subdir/.config | 2 ++ test cases/keyval/2 subdir/dir/meson.build | 12 ++++++++++++ test cases/keyval/2 subdir/meson.build | 4 ++++ test cases/keyval/3 load_config files/dir/config | 2 ++ test cases/keyval/3 load_config files/dir/meson.build | 12 ++++++++++++ test cases/keyval/3 load_config files/meson.build | 4 ++++ test cases/keyval/4 load_config builddir/config | 2 ++ test cases/keyval/4 load_config builddir/meson.build | 14 ++++++++++++++ 11 files changed, 80 insertions(+) create mode 100644 test cases/keyval/1 basic/.config create mode 100644 test cases/keyval/1 basic/meson.build create mode 100644 test cases/keyval/1 basic/test.json create mode 100644 test cases/keyval/2 subdir/.config create mode 100644 test cases/keyval/2 subdir/dir/meson.build create mode 100644 test cases/keyval/2 subdir/meson.build create mode 100644 test cases/keyval/3 load_config files/dir/config create mode 100644 test cases/keyval/3 load_config files/dir/meson.build create mode 100644 test cases/keyval/3 load_config files/meson.build create mode 100644 test cases/keyval/4 load_config builddir/config create mode 100644 test cases/keyval/4 load_config builddir/meson.build (limited to 'test cases/keyval') diff --git a/test cases/keyval/1 basic/.config b/test cases/keyval/1 basic/.config new file mode 100644 index 0000000..071d185 --- /dev/null +++ b/test cases/keyval/1 basic/.config @@ -0,0 +1,3 @@ +CONFIG_VAL1=y +# CONFIG_VAL2 is not set +CONFIG_VAL_VAL=4 diff --git a/test cases/keyval/1 basic/meson.build b/test cases/keyval/1 basic/meson.build new file mode 100644 index 0000000..a6e023e --- /dev/null +++ b/test cases/keyval/1 basic/meson.build @@ -0,0 +1,18 @@ +project('keyval basic test', meson_version : '>= 0.55') + +k = import('keyval') +conf = k.load('.config') + +if not conf.has_key('CONFIG_VAL1') + error('Expected CONFIG_VAL1 to be set, but it wasn\'t') +endif + +if conf.has_key('CONFIG_VAL2') + error('Expected CONFIG_VAL2 not be set, but it was') +endif + +if conf.get('CONFIG_VAL_VAL').to_int() != 4 + error('Expected CONFIG_VAL_VAL to be 4') +endif + +k = import('unstable-keyval') diff --git a/test cases/keyval/1 basic/test.json b/test cases/keyval/1 basic/test.json new file mode 100644 index 0000000..1f8fd9b --- /dev/null +++ b/test cases/keyval/1 basic/test.json @@ -0,0 +1,7 @@ +{ + "stdout": [ + { + "line": "test cases/keyval/1 basic/meson.build:3: WARNING: Project targets '>= 0.55' but uses feature introduced in '0.56.0': module keyval as stable module. Consider either adding \"unstable-\" to the module name, or updating the meson required version to \">= 0.56.0\"" + } + ] +} diff --git a/test cases/keyval/2 subdir/.config b/test cases/keyval/2 subdir/.config new file mode 100644 index 0000000..0599d46 --- /dev/null +++ b/test cases/keyval/2 subdir/.config @@ -0,0 +1,2 @@ +CONFIG_IS_SET=y +# CONFIG_NOT_IS_SET is not set diff --git a/test cases/keyval/2 subdir/dir/meson.build b/test cases/keyval/2 subdir/dir/meson.build new file mode 100644 index 0000000..3db80ad --- /dev/null +++ b/test cases/keyval/2 subdir/dir/meson.build @@ -0,0 +1,12 @@ + +k = import('keyval') + +conf = k.load(meson.source_root() / '.config') + +if not conf.has_key('CONFIG_IS_SET') + error('Expected CONFIG_IS_SET to be set, but it wasn\'t') +endif + +if conf.has_key('CONFIG_NOT_IS_SET') + error('Expected CONFIG_NOT_IS_SET not be set, but it was') +endif diff --git a/test cases/keyval/2 subdir/meson.build b/test cases/keyval/2 subdir/meson.build new file mode 100644 index 0000000..0651acf --- /dev/null +++ b/test cases/keyval/2 subdir/meson.build @@ -0,0 +1,4 @@ +project('keyval subdir test') + +# Test into sub directory +subdir('dir') diff --git a/test cases/keyval/3 load_config files/dir/config b/test cases/keyval/3 load_config files/dir/config new file mode 100644 index 0000000..0599d46 --- /dev/null +++ b/test cases/keyval/3 load_config files/dir/config @@ -0,0 +1,2 @@ +CONFIG_IS_SET=y +# CONFIG_NOT_IS_SET is not set diff --git a/test cases/keyval/3 load_config files/dir/meson.build b/test cases/keyval/3 load_config files/dir/meson.build new file mode 100644 index 0000000..d8826ec --- /dev/null +++ b/test cases/keyval/3 load_config files/dir/meson.build @@ -0,0 +1,12 @@ + +k = import('keyval') + +conf = k.load(files('config')) + +if not conf.has_key('CONFIG_IS_SET') + error('Expected CONFIG_IS_SET to be set, but it wasn\'t') +endif + +if conf.has_key('CONFIG_NOT_IS_SET') + error('Expected CONFIG_NOT_IS_SET not be set, but it was') +endif diff --git a/test cases/keyval/3 load_config files/meson.build b/test cases/keyval/3 load_config files/meson.build new file mode 100644 index 0000000..0651acf --- /dev/null +++ b/test cases/keyval/3 load_config files/meson.build @@ -0,0 +1,4 @@ +project('keyval subdir test') + +# Test into sub directory +subdir('dir') diff --git a/test cases/keyval/4 load_config builddir/config b/test cases/keyval/4 load_config builddir/config new file mode 100644 index 0000000..0599d46 --- /dev/null +++ b/test cases/keyval/4 load_config builddir/config @@ -0,0 +1,2 @@ +CONFIG_IS_SET=y +# CONFIG_NOT_IS_SET is not set diff --git a/test cases/keyval/4 load_config builddir/meson.build b/test cases/keyval/4 load_config builddir/meson.build new file mode 100644 index 0000000..6bd83db --- /dev/null +++ b/test cases/keyval/4 load_config builddir/meson.build @@ -0,0 +1,14 @@ +project('keyval builddir test') + +k = import('keyval') + +out_conf = configure_file(input: 'config', output: 'out-config', copy: true) +conf = k.load(out_conf) + +if not conf.has_key('CONFIG_IS_SET') + error('Expected CONFIG_IS_SET to be set, but it wasn\'t') +endif + +if conf.has_key('CONFIG_NOT_IS_SET') + error('Expected CONFIG_NOT_IS_SET not be set, but it was') +endif -- cgit v1.2.3