<commit_before>Code.require_file "../test_helper", __FILE__

defrecord RecordTest.FileInfo,
  Record.extract(:file_info, from_lib: "kernel/include/file.hrl")

name = RecordTest.DynamicName
defrecord name, a: 0, b: 1

defmodule RecordTest do
  use ExUnit.Case

  test :record_constructor_with_dict do
    record   = RecordTest.FileInfo.new(type: :regular)
    assert record.type == :regular
    assert record.access == nil
  end

  test :record_accessors do
    record = RecordTest.FileInfo.new(file_info)
    assert record.type == :regular
    assert record.access == :read_write

    new_record = record.access :read
    assert new_record.access == :read<commit_msg>Ensure records can be created with no field, closes #299<commit_after>Code.require_file "../test_helper", __FILE__

defrecord RecordTest.FileInfo,
  Record.extract(:file_info, from_lib: "kernel/include/file.hrl")

name = RecordTest.DynamicName
defrecord name, a: 0, b: 1

defrecord RecordTest.WithNoField, []

defmodule RecordTest do
  use ExUnit.Case

  test :record_constructor_with_dict do
    record   = RecordTest.FileInfo.new(type: :regular)
    assert record.type == :regular
    assert record.access == nil
  end

  test :record_accessors do
    record = RecordTest.FileInfo.new(file_info)
    assert record.type == :regular
    assert record.access == :read_write

    new_record = record.access :read
    assert new_record.access == :read
{'fraction_non_alphanumeric': 0.09752650176678446, 'fraction_numerical': 0.0049469964664310955, 'mean_word_length': 4.149090909090909, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4483696', 'n_tokens_mistral': 452, 'n_tokens_neox': 439, 'n_words': 112}