diff options
author | Benjamin Berg <bberg@redhat.com> | 2022-05-31 18:43:58 +0200 |
---|---|---|
committer | Benjamin Berg <bberg@redhat.com> | 2022-06-01 15:28:27 +0200 |
commit | 0b89905b2b78ac896e7b20d7020437ba9288bca8 (patch) | |
tree | c64ba8851d00ba30985ad7a52850a163d56af5d0 | |
parent | 5a09eb04782cda42ecebf84019fba1d8380c254b (diff) | |
download | libgudev-0b89905b2b78ac896e7b20d7020437ba9288bca8.tar.gz |
tests: Add test for g_udev_device_get_sysfs_attr_keys
-rw-r--r-- | tests/test-sysfsattr.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test-sysfsattr.c b/tests/test-sysfsattr.c index 88788ae..7dcf0dd 100644 --- a/tests/test-sysfsattr.c +++ b/tests/test-sysfsattr.c @@ -96,6 +96,21 @@ test_uncached_sysfs_attr (Fixture *f, G_GNUC_UNUSED const void *data) g_assert_true (g_udev_device_get_sysfs_attr_as_boolean_uncached (dev, "console")); } +static void +test_sysfs_attr_keys (Fixture *f, G_GNUC_UNUSED const void *data) +{ + const char *expected[] = { "console", "dytc_lapmode", "subsystem", "uevent", NULL }; + g_autoptr(GUdevDevice) dev = NULL; + + dev = create_single_dev (f, "P: /devices/dev1\n" + "E: SUBSYSTEM=platform\n" + "A: dytc_lapmode=1\n" + "A: console=Y\\n\n" + "E: ID_MODEL=KoolGadget"); + + g_assert_cmpstrv (g_udev_device_get_sysfs_attr_keys (dev), expected); +} + int main(int argc, char **argv) { setlocale (LC_ALL, NULL); @@ -106,5 +121,10 @@ int main(int argc, char **argv) test_uncached_sysfs_attr, fixture_teardown); + g_test_add ("/gudev/sysfs_attr_keys", Fixture, NULL, + fixture_setup, + test_sysfs_attr_keys, + fixture_teardown); + return g_test_run (); } |