<commit_before>package com.vladsch.flexmark.test;

import com.vladsch.flexmark.spec.SpecExample;
import com.vladsch.flexmark.util.builder.BuilderBase;
import com.vladsch.flexmark.util.builder.Extension;
import com.vladsch.flexmark.util.data.DataHolder;
import com.vladsch.flexmark.util.data.DataKey;
import com.vladsch.flexmark.util.data.DataSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.ComparisonFailure;
import org.junit.Rule;
import org.junit.rules.ExpectedException;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;

import static org.junit.Assert.assertEquals;

public abstract class RenderingTestCase implements SpecExampleProcessor {
    public static final DataKey<Boolean> IGNORE = TestUtils.IGNORE;
    public static final DataKey<Boolean> FAIL = TestUtils.FAIL;
    public static final DataKey<Boolean> NO_FILE_EOL = TestUtils.NO_FILE_EOL;
    public static final DataKey<Integer> TIMED_ITERATIONS = TestUtils.TIMED_ITERATIONS;
    public static final DataKey<Boolean> EMBED_TIMED = TestUtils.EMBED_TIMED;
    public static final DataKey<Boolean> TIMED = TestUtils.TIMED;
    public static final DataKey<String> INCLUDED_DOCUMENT = TestUtils.INCLUDED_DOCUMENT;
    public static final DataKey<String> SOURCE_PREFIX = TestUtils.SOURCE_PREFIX;
    public static final DataKey<String> SOURCE_SUFFIX = TestUtils.SOURCE_SUFFIX;
    public static final DataKey<String> SOURCE_INDENT = TestUtils.SOURCE_INDENT;

    public static final DataHolder NO_FILE_EOL_FALSE = TestUtils.NO_FILE_EOL_FALSE;
    public static final String DEFAULT_SPEC_RESOURCE = TestUtils.DEFAULT_SPEC_RESOURCE;
    public static final String DEFAULT_URL_PREFIX = TestUtils.DEFAULT_URL_PREFIX;
    public static final DataKey<Collection<Extension>> UNLOAD_EXTENSIONS = TestUtils.UNLOAD_EXTENSIONS;
    public static final DataKey<Collection<Extension>> LOAD_EXTENSIONS = TestUtils.LOAD_EXTENSIONS;
    public static final DataKey<Collection<Extension>> EXTENSIONS = BuilderBase.EXTENSIONS;

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @NotNull
    public abstract SpecExample getExample();

    /**
     * Override if combining option by overwriting corresponding keys is not sufficient
     *
     * @param other     options (set first), can be null
     * @param overrides options (set second) can be null
     * @return combined options, default implementation simply overwrites values of corresponding keys in overrides
     */
    @Nullable
    @Override
    public DataHolder combineOptions(@Nullable DataHolder other, @Nullable DataHolder overrides) {
        // here we handle load and unload extension directives to convert them to adding/removing extensions from EXTENSIONS
        if (other != null && overrides != null) {
            return new DataSet(resolveLoadUnload(other), resolveLoadUnload(overrides));
        } else if (other != null) {
            return resolveLoadUnload(other);
        } else {
            return resolveLoadUnload(overrides);<commit_msg>add SharedDataKeys for sharing common keys across modules<commit_after>package com.vladsch.flexmark.test;

import com.vladsch.flexmark.spec.SpecExample;
import com.vladsch.flexmark.util.SharedDataKeys;
import com.vladsch.flexmark.util.builder.BuilderBase;
import com.vladsch.flexmark.util.builder.Extension;
import com.vladsch.flexmark.util.data.DataHolder;
import com.vladsch.flexmark.util.data.DataKey;
import com.vladsch.flexmark.util.data.DataSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.junit.ComparisonFailure;
import org.junit.Rule;
import org.junit.rules.ExpectedException;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashSet;

import static org.junit.Assert.assertEquals;

public abstract class RenderingTestCase implements SpecExampleProcessor {
    public static final DataKey<Boolean> IGNORE = TestUtils.IGNORE;
    public static final DataKey<Boolean> FAIL = TestUtils.FAIL;
    public static final DataKey<Boolean> NO_FILE_EOL = TestUtils.NO_FILE_EOL;
    public static final DataKey<Integer> TIMED_ITERATIONS = TestUtils.TIMED_ITERATIONS;
    public static final DataKey<Boolean> EMBED_TIMED = TestUtils.EMBED_TIMED;
    public static final DataKey<Boolean> TIMED = TestUtils.TIMED;
    public static final DataKey<String> INCLUDED_DOCUMENT = TestUtils.INCLUDED_DOCUMENT;
    public static final DataKey<String> SOURCE_PREFIX = TestUtils.SOURCE_PREFIX;
    public static final DataKey<String> SOURCE_SUFFIX = TestUtils.SOURCE_SUFFIX;
    public static final DataKey<String> SOURCE_INDENT = TestUtils.SOURCE_INDENT;

    public static final DataHolder NO_FILE_EOL_FALSE = TestUtils.NO_FILE_EOL_FALSE;
    public static final String DEFAULT_SPEC_RESOURCE = TestUtils.DEFAULT_SPEC_RESOURCE;
    public static final String DEFAULT_URL_PREFIX = TestUtils.DEFAULT_URL_PREFIX;
    public static final DataKey<Collection<Extension>> UNLOAD_EXTENSIONS = TestUtils.UNLOAD_EXTENSIONS;
    public static final DataKey<Collection<Extension>> LOAD_EXTENSIONS = TestUtils.LOAD_EXTENSIONS;
    public static final DataKey<Collection<Extension>> EXTENSIONS = SharedDataKeys.EXTENSIONS;

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    @NotNull
    public abstract SpecExample getExample();

    /**
     * Override if combining option by overwriting corresponding keys is not sufficient
     *
     * @param other     options (set first), can be null
     * @param overrides options (set second) can be null
     * @return combined options, default implementation simply overwrites values of corresponding keys in overrides
     */
    @Nullable
    @Override
    public DataHolder combineOptions(@Nullable DataHolder other, @Nullable DataHolder overrides) {
        // here we handle load and unload extension directives to convert them to adding/removing extensions from EXTENSIONS
        if (other != null && overrides != null) {
            return new DataSet(resolveLoadUnload(other), resolveLoadUnload(overrides));
        } else if (other != null) {
            return resolveLoadUnload(other);
        } else {
            return resolveLoadUnload(overrides);
{'fraction_non_alphanumeric': 0.07240611075747931, 'fraction_numerical': 0.0, 'mean_word_length': 4.682640144665461, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, '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': '3960063', 'n_tokens_mistral': 1776, 'n_tokens_neox': 1731, 'n_words': 466}