<commit_before>package io.kotlintest

import io.kotlintest.matchers.Matcher
import io.kotlintest.matchers.Matchers
import io.kotlintest.matchers.Result
import io.kotlintest.properties.PropertyTesting
import io.kotlintest.properties.TableTesting
import org.junit.runner.Description
import org.junit.runner.RunWith
import org.junit.runner.notification.Failure
import org.junit.runner.notification.RunNotifier
import org.junit.runners.model.TestTimedOutException
import java.io.Closeable
import java.util.*
import java.util.concurrent.Callable
import java.util.concurrent.Executors
import java.util.concurrent.Future

@RunWith(KTestJUnitRunner::class)
abstract class TestBase : PropertyTesting(), Matchers, TableTesting {

  protected open val oneInstancePerTest = true

  // the root test suite which uses the simple name of the class as the name of the suite
  // spec implementations will add their tests to this suite
  val root = TestSuite(javaClass.simpleName, ArrayList<TestSuite>(), ArrayList<TestCase>())

  // returns a jUnit Description for the currently registered tests
  val description: Description
    get() = descriptionForSuite(root)

  /**
   * Config applied to each test case if not overridden per test case.
   *
   * Initialize this property by calling the config method.
   * @see config
   * @see TestBase.config
   */
  protected open val defaultTestCaseConfig: TestConfig = TestConfig()

  /**
   * Interceptors that intercepts the execution of the whole spec. Interceptors are executed from
   * left to right.
   */
  protected open val specInterceptors: Iterable<(TestBase, () -> Unit) -> Unit> = listOf()

  private val closeablesInReverseOrder = LinkedList<Closeable>()

  fun run(notifier: RunNotifier) {
    Project.beforeAll()

    val initialInterceptor = { context: TestBase, testCase: () -> Unit ->
      interceptSpec(context, { testCase() })
    }
    val interceptorChain = createInterceptorChain(specInterceptors, initialInterceptor)

    interceptorChain(this, {
      if (oneInstancePerTest)
        runOneInstancePerTest(notifier)<commit_msg>#77 change type of TestBase.specInterceptors to List to guarantee order<commit_after>package io.kotlintest

import io.kotlintest.matchers.Matcher
import io.kotlintest.matchers.Matchers
import io.kotlintest.matchers.Result
import io.kotlintest.properties.PropertyTesting
import io.kotlintest.properties.TableTesting
import org.junit.runner.Description
import org.junit.runner.RunWith
import org.junit.runner.notification.Failure
import org.junit.runner.notification.RunNotifier
import org.junit.runners.model.TestTimedOutException
import java.io.Closeable
import java.util.*
import java.util.concurrent.Callable
import java.util.concurrent.Executors
import java.util.concurrent.Future

@RunWith(KTestJUnitRunner::class)
abstract class TestBase : PropertyTesting(), Matchers, TableTesting {

  protected open val oneInstancePerTest = true

  // the root test suite which uses the simple name of the class as the name of the suite
  // spec implementations will add their tests to this suite
  val root = TestSuite(javaClass.simpleName, ArrayList<TestSuite>(), ArrayList<TestCase>())

  // returns a jUnit Description for the currently registered tests
  val description: Description
    get() = descriptionForSuite(root)

  /**
   * Config applied to each test case if not overridden per test case.
   *
   * Initialize this property by calling the config method.
   * @see config
   * @see TestBase.config
   */
  protected open val defaultTestCaseConfig: TestConfig = TestConfig()

  /**
   * Interceptors that intercepts the execution of the whole spec. Interceptors are executed from
   * left to right.
   */
  protected open val specInterceptors: List<(TestBase, () -> Unit) -> Unit> = listOf()

  private val closeablesInReverseOrder = LinkedList<Closeable>()

  fun run(notifier: RunNotifier) {
    Project.beforeAll()

    val initialInterceptor = { context: TestBase, testCase: () -> Unit ->
      interceptSpec(context, { testCase() })
    }
    val interceptorChain = createInterceptorChain(specInterceptors, initialInterceptor)

    interceptorChain(this, {
      if (oneInstancePerTest)
        runOneInstancePerTest(notifier)
{'fraction_non_alphanumeric': 0.08289909995262909, 'fraction_numerical': 0.0004737091425864519, 'mean_word_length': 4.520261437908497, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '7138242', 'n_tokens_mistral': 1175, 'n_tokens_neox': 1125, 'n_words': 344}