mirror of
https://github.com/NixOS/nix.git
synced 2025-11-18 08:19:35 +01:00
test/libutil: Add OBSERVE_STRING macro
Makes string callback easier to pass, without mistakes.
This commit is contained in:
parent
876e70bc9a
commit
a512f4eebc
4 changed files with 33 additions and 20 deletions
12
tests/unit/libutil-support/tests/string_callback.hh
Normal file
12
tests/unit/libutil-support/tests/string_callback.hh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace nix::testing {
|
||||
|
||||
void observe_string_cb(const char * start, unsigned int n, std::string * user_data);
|
||||
inline void * observe_string_cb_data(std::string & out) {
|
||||
return (void *) &out;
|
||||
};
|
||||
#define OBSERVE_STRING(str) (void *)nix::testing::observe_string_cb, nix::testing::observe_string_cb_data(str)
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue