<commit_before>require File.expand_path('../../test_helper', __FILE__)

describe StarScope::Record do

  it "must symbolize compound name" do
    rec = StarScope::Record.build(:foo, ["a", :b], {})
    rec[:name].must_equal [:a, :b]
  end

  it "must symbolize and array-wrap simple name" do
    rec = StarScope::Record.build(:foo, "a", {})
    rec[:name].must_equal [:a]
  end

  it "must read correct line from file" do
    rec = StarScope::Record.build(GOLANG_SAMPLE, :a, {:line_no => 1})
    rec[:line].must_equal "package main"
  end

end<commit_msg>improve tests<commit_after>require File.expand_path('../../test_helper', __FILE__)

describe StarScope::Record do

  it "must symbolize compound name" do
    rec = StarScope::Record.build(:foo, ["a", :b], {})
    rec[:name].must_equal [:a, :b]
  end

  it "must symbolize and array-wrap simple name" do
    rec = StarScope::Record.build(:foo, "a", {})
    rec[:name].must_equal [:a]
  end

  it "must read correct line from file" do

    # we interleave the files here to test the cache

    rec = StarScope::Record.build(GOLANG_SAMPLE, :a, {:line_no => 1})
    rec[:line].must_equal "package main"

    rec = StarScope::Record.build(GOLANG_SAMPLE, :a, {:line_no => 62})
    rec[:line].must_equal "\tfmt.Println(t)"

    rec = StarScope::Record.build(RUBY_SAMPLE, :a, {:line_no => 1})
    rec[:line].must_equal "require 'date'"

    rec = StarScope::Record.build(RUBY_SAMPLE, :a, {:line_no => 163})
    rec[:line].must_equal "end"

    rec = StarScope::Record.build(GOLANG_SAMPLE, :a, {:line_no => 63})
    rec[:line].must_equal "}"
  end

end
{'fraction_non_alphanumeric': 0.16781465247338762, 'fraction_numerical': 0.006261740763932373, 'mean_word_length': 3.916923076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3480105', 'n_tokens_mistral': 590, 'n_tokens_neox': 559, 'n_words': 141}