forked from cory/tildefriends
js: Move /save to C.
This commit is contained in:
@ -158,6 +158,29 @@ void tf_ssb_test_ssb(const tf_test_options_t* options)
|
||||
tf_ssb_t* ssb1 = tf_ssb_create(&loop, NULL, "file:out/test_db1.sqlite", NULL);
|
||||
tf_ssb_register(tf_ssb_get_context(ssb1), ssb1);
|
||||
|
||||
const char* value = tf_ssb_db_get_property(ssb0, "user", "array");
|
||||
assert(value == NULL);
|
||||
assert(tf_ssb_db_add_value_to_array_property(ssb0, "user", "array", "1") == true);
|
||||
value = tf_ssb_db_get_property(ssb0, "user", "array");
|
||||
assert(strcmp(value, "[\"1\"]") == 0);
|
||||
tf_free((void*)value);
|
||||
assert(tf_ssb_db_add_value_to_array_property(ssb0, "user", "array", "2") == true);
|
||||
value = tf_ssb_db_get_property(ssb0, "user", "array");
|
||||
assert(strcmp(value, "[\"1\",\"2\"]") == 0);
|
||||
tf_free((void*)value);
|
||||
assert(tf_ssb_db_add_value_to_array_property(ssb0, "user", "array", "1") == false);
|
||||
assert(tf_ssb_db_add_value_to_array_property(ssb0, "user", "array", "2") == false);
|
||||
value = tf_ssb_db_get_property(ssb0, "user", "array");
|
||||
assert(strcmp(value, "[\"1\",\"2\"]") == 0);
|
||||
tf_free((void*)value);
|
||||
assert(tf_ssb_db_remove_value_from_array_property(ssb0, "user", "array", "1") == true);
|
||||
assert(tf_ssb_db_remove_value_from_array_property(ssb0, "user", "array", "1") == false);
|
||||
assert(tf_ssb_db_remove_value_from_array_property(ssb0, "user", "array", "2") == true);
|
||||
assert(tf_ssb_db_remove_value_from_array_property(ssb0, "user", "array", "2") == false);
|
||||
value = tf_ssb_db_get_property(ssb0, "user", "array");
|
||||
assert(strcmp(value, "[]") == 0);
|
||||
tf_free((void*)value);
|
||||
|
||||
uv_idle_t idle0 = { .data = ssb0 };
|
||||
uv_idle_init(&loop, &idle0);
|
||||
uv_idle_start(&idle0, _ssb_test_idle);
|
||||
|
Reference in New Issue
Block a user