Merge remote-tracking branch 'origin/master' into thedrow-patch-1

This commit is contained in:
c9s 2014-05-21 18:51:12 +08:00
commit d86f6dd12c

View file

@ -15,16 +15,21 @@
START_TEST (test_slug_compile)
{
char * path = "/user/{id}";
ck_assert_str_eq( slug_compile(path, strlen(path) ) , "/user/([^/]+)" );
char * c = NULL;
ck_assert_str_eq( c = slug_compile(path, strlen(path) ) , "/user/([^/]+)" );
zfree(c);
char * path2 = "/what/{id}-foo";
ck_assert_str_eq( slug_compile(path2, strlen(path2) ) , "/what/([^/]+)-foo" );
ck_assert_str_eq( c = slug_compile(path2, strlen(path2) ) , "/what/([^/]+)-foo" );
zfree(c);
char * path3 = "-{id}";
ck_assert_str_eq(slug_compile(path3, strlen(path3)), "-([^/]+)" );
ck_assert_str_eq( c = slug_compile(path3, strlen(path3)), "-([^/]+)" );
zfree(c);
char * path4 = "-{idx:\\d{3}}";
ck_assert_str_eq(slug_compile(path4, strlen(path4)), "-(\\d{3})" );
ck_assert_str_eq( c = slug_compile(path4, strlen(path4)), "-(\\d{3})" );
zfree(c);
}
END_TEST