From 5e2a6fb88eaee49b018f25e34818663180c43d1c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 9 Feb 2021 13:06:51 +0100 Subject: [PATCH] tests: test defines hash table --- src/test.rs | 6 ++++++ src/tests/testlib.pc | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test.rs b/src/test.rs index 2af3c2e..228bed3 100644 --- a/src/test.rs +++ b/src/test.rs @@ -67,6 +67,12 @@ fn good() { let (libraries, flags) = toml("toml-good", vec![]).unwrap(); let testlib = libraries.get_by_name("testlib").unwrap(); assert_eq!(testlib.version, "1.2.3"); + assert_eq!( + testlib.defines.get("BADGER").unwrap().as_deref(), + Some("yes") + ); + assert!(testlib.defines.get("AWESOME").unwrap().is_none()); + let testdata = libraries.get_by_name("testdata").unwrap(); assert_eq!(testdata.version, "4.5.6"); assert!(libraries.get_by_name("testmore").is_none()); diff --git a/src/tests/testlib.pc b/src/tests/testlib.pc index 9dfd146..4b25f22 100644 --- a/src/tests/testlib.pc +++ b/src/tests/testlib.pc @@ -7,4 +7,4 @@ Name: Test Library Description: A fake library to test pkg-config. Version: 1.2.3 Libs: -L${libdir} -ltest -F${libdir} -framework someframework -Cflags: -I${includedir} +Cflags: -I${includedir} -DBADGER=yes -DAWESOME