<commit_before>#include "FailingResourceLoader.hxx"
#include "processor.hxx"
#include "penv.hxx"
#include "PInstance.hxx"
#include "uri/uri_parser.hxx"
#include "widget/Inline.hxx"
#include "widget/Widget.hxx"
#include "widget/Class.hxx"
#include "widget/LookupHandler.hxx"
#include "widget/RewriteUri.hxx"
#include "istream/istream.hxx"
#include "istream/istream_block.hxx"
#include "istream/istream_string.hxx"
#include "util/Cancellable.hxx"

#include <glib.h>

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

/*
 * emulate missing libraries
 *
 */

struct tcache *global_translate_cache;

Istream *
embed_inline_widget(struct pool &pool,
                    gcc_unused struct processor_env &env,
                    gcc_unused bool plain_text,
                    Widget &widget)
{
    const char *s = widget.GetIdPath();
    if (s == nullptr)
        s = "widget";

    return istream_string_new(&pool, s);
}

WidgetSession *
widget_get_session(gcc_unused Widget *widget,
                   gcc_unused RealmSession *session,
                   gcc_unused bool create)
{
    return nullptr;
}

enum uri_mode
parse_uri_mode(gcc_unused StringView s)
{
    return URI_MODE_DIRECT;
}

Istream *
rewrite_widget_uri(gcc_unused struct pool &pool,
                   gcc_unused struct processor_env &env,
                   gcc_unused struct tcache &translate_cache,
                   gcc_unused Widget &widget,
                   gcc_unused StringView value,
                   gcc_unused enum uri_mode mode,
                   gcc_unused bool stateful,
                   gcc_unused const char *view,
                   gcc_unused const struct escape_class *escape)
{
    return nullptr;
}

/*
 * WidgetLookupHandler
 *
 */

class MyWidgetLookupHandler final : public WidgetLookupHandler {
public:
    /* virtual methods from class WidgetLookupHandler */
    void WidgetFound(gcc_unused Widget &widget) override {
        g_printerr("widget found\n");
    }

    void WidgetNotFound() override {
        g_printerr("widget not found\n");
    }

    void WidgetLookupError(GError *error) override {
        g_printerr("%s\n", error->message);
        g_error_free(error);
    }
};

/*
 * tests
 *
 */

static void
test_proxy_abort()
{
    PInstance instance;

    bool success;<commit_msg>test/t_processor: use fprintf() instead of g_printerr()<commit_after>#include "FailingResourceLoader.hxx"
#include "processor.hxx"
#include "penv.hxx"
#include "PInstance.hxx"
#include "uri/uri_parser.hxx"
#include "widget/Inline.hxx"
#include "widget/Widget.hxx"
#include "widget/Class.hxx"
#include "widget/LookupHandler.hxx"
#include "widget/RewriteUri.hxx"
#include "istream/istream.hxx"
#include "istream/istream_block.hxx"
#include "istream/istream_string.hxx"
#include "util/Cancellable.hxx"

#include <glib.h>

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

/*
 * emulate missing libraries
 *
 */

struct tcache *global_translate_cache;

Istream *
embed_inline_widget(struct pool &pool,
                    gcc_unused struct processor_env &env,
                    gcc_unused bool plain_text,
                    Widget &widget)
{
    const char *s = widget.GetIdPath();
    if (s == nullptr)
        s = "widget";

    return istream_string_new(&pool, s);
}

WidgetSession *
widget_get_session(gcc_unused Widget *widget,
                   gcc_unused RealmSession *session,
                   gcc_unused bool create)
{
    return nullptr;
}

enum uri_mode
parse_uri_mode(gcc_unused StringView s)
{
    return URI_MODE_DIRECT;
}

Istream *
rewrite_widget_uri(gcc_unused struct pool &pool,
                   gcc_unused struct processor_env &env,
                   gcc_unused struct tcache &translate_cache,
                   gcc_unused Widget &widget,
                   gcc_unused StringView value,
                   gcc_unused enum uri_mode mode,
                   gcc_unused bool stateful,
                   gcc_unused const char *view,
                   gcc_unused const struct escape_class *escape)
{
    return nullptr;
}

/*
 * WidgetLookupHandler
 *
 */

class MyWidgetLookupHandler final : public WidgetLookupHandler {
public:
    /* virtual methods from class WidgetLookupHandler */
    void WidgetFound(gcc_unused Widget &widget) override {
        fprintf(stderr, "widget found\n");
    }

    void WidgetNotFound() override {
        fprintf(stderr, "widget not found\n");
    }

    void WidgetLookupError(GError *error) override {
        g_printerr("%s\n", error->message);
        g_error_free(error);
    }
};

/*
 * tests
 *
 */

static void
test_proxy_abort()
{
    PInstance instance;

    bool success;
{'fraction_non_alphanumeric': 0.0994077834179357, 'fraction_numerical': 0.0, 'mean_word_length': 2.7741420590582604, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2717922', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1497, 'n_words': 340}