<commit_before>require 'test_helper'

class EngineTest < Haml::TestCase
  # A map of erroneous Haml documents to the error messages they should produce.
  # The error messages may be arrays;
  # if so, the second element should be the line number that should be reported for the error.
  # If this isn't provided, the tests will assume the line number should be the last line of the document.
  EXCEPTION_MAP = {
    "!!!\n  a"                                             => error(:illegal_nesting_header),
    "a\n  b"                                               => error(:illegal_nesting_plain),
    "/ a\n  b"                                             => error(:illegal_nesting_content),
    "% a"                                                  => error(:invalid_tag, '% a'),
    "%p a\n  b"                                            => error(:illegal_nesting_line, 'p'),
    "%p="                                                  => error(:no_ruby_code, '='),
    "%p~"                                                  => error(:no_ruby_code, '~'),
    "~"                                                    => error(:no_ruby_code, '~'),
    "="                                                    => error(:no_ruby_code, '='),
    "%p/\n  a"                                             => error(:illegal_nesting_self_closing),
    ":a\n  b"                                              => [error(:filter_not_defined, 'a'), 1],
    ":a= b"                                                => error(:invalid_filter_name, 'a= b'),
    "."                                                    => error(:illegal_element),
    ".#"                                                   => error(:illegal_element),
    ".{} a"                                                => error(:illegal_element),
    ".() a"                                                => error(:illegal_element),
    ".= a"                                                 => error(:illegal_element),
    "%p..a"                                                => error(:illegal_element),
    "%a/ b"                                                => error(:self_closing_content),
    " %p foo"                                              => error(:indenting_at_start),
    "  %p foo"                                             => error(:indenting_at_start),<commit_msg>Allow execution without specifying load path<commit_after>$:.unshift __dir__

require 'test_helper'

class EngineTest < Haml::TestCase
  # A map of erroneous Haml documents to the error messages they should produce.
  # The error messages may be arrays;
  # if so, the second element should be the line number that should be reported for the error.
  # If this isn't provided, the tests will assume the line number should be the last line of the document.
  EXCEPTION_MAP = {
    "!!!\n  a"                                             => error(:illegal_nesting_header),
    "a\n  b"                                               => error(:illegal_nesting_plain),
    "/ a\n  b"                                             => error(:illegal_nesting_content),
    "% a"                                                  => error(:invalid_tag, '% a'),
    "%p a\n  b"                                            => error(:illegal_nesting_line, 'p'),
    "%p="                                                  => error(:no_ruby_code, '='),
    "%p~"                                                  => error(:no_ruby_code, '~'),
    "~"                                                    => error(:no_ruby_code, '~'),
    "="                                                    => error(:no_ruby_code, '='),
    "%p/\n  a"                                             => error(:illegal_nesting_self_closing),
    ":a\n  b"                                              => [error(:filter_not_defined, 'a'), 1],
    ":a= b"                                                => error(:invalid_filter_name, 'a= b'),
    "."                                                    => error(:illegal_element),
    ".#"                                                   => error(:illegal_element),
    ".{} a"                                                => error(:illegal_element),
    ".() a"                                                => error(:illegal_element),
    ".= a"                                                 => error(:illegal_element),
    "%p..a"                                                => error(:illegal_element),
    "%a/ b"                                                => error(:self_closing_content),
    " %p foo"                                              => error(:indenting_at_start),
    "  %p foo"                                             => error(:indenting_at_start),
{'fraction_non_alphanumeric': 0.11172122492080254, 'fraction_numerical': 0.00042238648363252375, 'mean_word_length': 0.8601728201099764, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 84, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7444974', 'n_tokens_mistral': 996, 'n_tokens_neox': 974, 'n_words': 238}