<commit_before>require 'test/unit'

require File.dirname(__FILE__) + '/test_helper.rb'

class TrivialDataSourceTest < Test::Unit::TestCase

  def setup
    $quiet = true unless ENV['QUIET'] == 'false'
  end

  def teardown
    Dir['test/fixtures/*/output/*'].each { |f| FileUtils.remove_entry_secure f if File.exist?(f)}
    $quiet = false
  end

  # Test preparation

  def test_up
  end

  def test_down
  end

  def test_setup
  end

  # Test loading data

  def test_pages
  end

  def test_page_defaults
  end

  def test_templates
  end

  def test_layouts
  end

  # Test creating data

  def test_create_page
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_raise(SystemExit)  { site.create_page('test') }
    end
  end

  def test_create_template
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_raise(SystemExit)  { site.create_page('test') }
    end
  end

  def test_create_layout
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_raise(SystemExit)  { site.create_page('test') }
    end
  end

  # Miscellaneous

  def test_compile_site
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_nothing_raised() { site.compile }
      assert(File.file?('output/index.html'))
      assert(File.file?('output/about/index.html'))
      assert_equal(2, Dir["output/*"].size)
      assert_match(/<body>Hi!<\/body>/, File.read('output/index.html'))
      assert_match(/<body>Hello there.<\/body>/, File.read('output/about/index.html'))
    end
  end

end
<commit_msg>fixed trivial data source test case bug which assumed incorrect output<commit_after>require 'test/unit'

require File.dirname(__FILE__) + '/test_helper.rb'

class TrivialDataSourceTest < Test::Unit::TestCase

  def setup
    $quiet = true unless ENV['QUIET'] == 'false'
  end

  def teardown
    Dir['test/fixtures/*/output/*'].each { |f| FileUtils.remove_entry_secure f if File.exist?(f)}
    $quiet = false
  end

  # Test preparation

  def test_up
  end

  def test_down
  end

  def test_setup
  end

  # Test loading data

  def test_pages
  end

  def test_page_defaults
  end

  def test_templates
  end

  def test_layouts
  end

  # Test creating data

  def test_create_page
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_raise(SystemExit)  { site.create_page('test') }
    end
  end

  def test_create_template
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_raise(SystemExit)  { site.create_page('test') }
    end
  end

  def test_create_layout
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_raise(SystemExit)  { site.create_page('test') }
    end
  end

  # Miscellaneous

  def test_compile_site
    with_site_fixture 'site_with_trivial_backend' do |site|
      assert_nothing_raised() { site.compile }
      assert(File.file?('output/index.html'))
      assert(File.file?('output/about/index.html'))
      assert_equal(2, Dir["output/*"].size)
      assert_match(/<body>\nHi!\n  <\/body>/, File.read('output/index.html'))
      assert_match(/<body>\nHello there.\n  <\/body>/, File.read('output/about/index.html'))
    end
  end

end

{'fraction_non_alphanumeric': 0.10982114841543772, 'fraction_numerical': 0.0006275494195167869, 'mean_word_length': 3.4838255977496484, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '6793691', 'n_tokens_mistral': 1119, 'n_tokens_neox': 1070, 'n_words': 226}