/** * compilerkit_to_string: * @fn compilerkit_to_string * Return a string representation of an object (i.e., regex, grammar). * @pre None * @param GObject* An object * @return A string representation of the object. The caller must free the returned string with `g_free()` * @memberof CompilerKitVisitor */ gchar *compilerkit_to_string (GObject *obj) { GString *str; CompilerKitVisitor *visitor = compilerkit_string_builder_visitor(); compilerkit_visitor_visit(visitor, obj); str = (GString *) compilerkit_visitor_get_state(visitor); g_object_unref (visitor); return g_string_free (str, FALSE); }
/** * test_string_builder_visitor: * @fn test_string_builder_visitor * Tests compilerkit_string_builder_visitor. * @pre None * @param None * @return void */ void test_string_builder_case (void) { CompilerKitVisitor *string_builder; g_test_message ("Testing StringBuilder visitor"); g_test_timer_start (); /** @todo Test here */ string_builder = compilerkit_string_builder_visitor(); g_assert(FALSE); g_object_unref (string_builder); // This test shouldn't take too long to run g_assert_cmpfloat(g_test_timer_elapsed (), <=, 1); }