]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
8a1baa3a | 2 | |
8a1baa3a | 3 | #include "ask-password-api.h" |
c7b7d74e | 4 | #include "strv.h" |
72c08a47 | 5 | #include "tests.h" |
8a1baa3a | 6 | |
72c08a47 | 7 | static void test_ask_password(void) { |
8a1baa3a | 8 | int r; |
c7b7d74e | 9 | _cleanup_strv_free_ char **ret = NULL; |
8a1baa3a | 10 | |
8aaf18e0 | 11 | r = ask_password_tty(-1, "hello?", "da key", 0, ASK_PASSWORD_CONSOLE_COLOR, NULL, &ret); |
72c08a47 ZJS |
12 | if (r == -ECANCELED) |
13 | assert_se(ret == NULL); | |
14 | else { | |
15 | assert_se(r >= 0); | |
16 | assert_se(strv_length(ret) == 1); | |
17 | log_info("Got \"%s\"", *ret); | |
18 | } | |
8a1baa3a ZJS |
19 | } |
20 | ||
21 | int main(int argc, char **argv) { | |
72c08a47 | 22 | test_setup_logging(LOG_DEBUG); |
8a1baa3a | 23 | |
72c08a47 | 24 | test_ask_password(); |
c22f885e | 25 | return EXIT_SUCCESS; |
8a1baa3a | 26 | } |