Permalink
Browse files

[test] Test long aliases, print test name

  • Loading branch information...
1 parent 44d3bcd commit 03230924e78a8b1063dd42b8ed170fe4fc335693 @mmalecki committed Mar 29, 2013
Showing with 23 additions and 0 deletions.
  1. +23 −0 test/test-saneopt.c
View
@@ -6,6 +6,8 @@
#include <saneopt.h>
void test_no_arg() {
+ printf("test_no_arg()\n");
+
char** argv;
saneopt_t* opt = saneopt_init(0, argv);
@@ -15,6 +17,8 @@ void test_no_arg() {
}
void test_no_value() {
+ printf("test_no_value()\n");
+
char** argv = malloc(1 * sizeof(char*));
argv[0] = "--option";
@@ -27,6 +31,8 @@ void test_no_value() {
}
void test_value() {
+ printf("test_value()\n");
+
char** argv = malloc(4 * sizeof(char*));
argv[0] = "--option";
@@ -43,11 +49,28 @@ void test_value() {
free(opt);
}
+void test_long_alias() {
+ printf("test_long_alias()\n");
+
+ char** argv = malloc(3 * sizeof(char*));
+
+ argv[0] = "--some-opt";
+ argv[1] = "--alias";
+ argv[2] = "value";
+
+ saneopt_t* opt = saneopt_init(3, argv);
+ saneopt_alias(opt, "option", "alias");
+ assert(strcmp(saneopt_get(opt, "option"), "value") == 0);
+
+ free(argv);
+ free(opt);
+}
int main(int argc, char** argv) {
test_no_arg();
test_no_value();
test_value();
+ test_long_alias();
return 0;
}

0 comments on commit 0323092

Please sign in to comment.