mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
test: env: Add a test of the new regex behavior for attrs
The behavior of the env attrs depends on CONFIG_REGEX. Add an additional test if that variable is set. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
b04d3553ee
commit
f68c2b2592
1 changed files with 27 additions and 0 deletions
27
test/env/attr.c
vendored
27
test/env/attr.c
vendored
|
@ -60,3 +60,30 @@ static int env_test_attrs_lookup(struct unit_test_state *uts)
|
|||
return 0;
|
||||
}
|
||||
ENV_TEST(env_test_attrs_lookup, 0);
|
||||
|
||||
#ifdef CONFIG_REGEX
|
||||
static int env_test_attrs_lookup_regex(struct unit_test_state *uts)
|
||||
{
|
||||
char attrs[32];
|
||||
|
||||
ut_assertok(env_attr_lookup("foo1?:bar", "foo", attrs));
|
||||
ut_asserteq_str("bar", attrs);
|
||||
|
||||
ut_assertok(env_attr_lookup("foo1?:bar", "foo1", attrs));
|
||||
ut_asserteq_str("bar", attrs);
|
||||
|
||||
ut_assertok(env_attr_lookup(".foo:bar", ".foo", attrs));
|
||||
ut_asserteq_str("bar", attrs);
|
||||
|
||||
ut_assertok(env_attr_lookup(".foo:bar", "ufoo", attrs));
|
||||
ut_asserteq_str("bar", attrs);
|
||||
|
||||
ut_assertok(env_attr_lookup("\\.foo:bar", ".foo", attrs));
|
||||
ut_asserteq_str("bar", attrs);
|
||||
|
||||
ut_asserteq(-ENOENT, env_attr_lookup("\\.foo:bar", "ufoo", attrs));
|
||||
|
||||
return 0;
|
||||
}
|
||||
ENV_TEST(env_test_attrs_lookup_regex, 0);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue