<commit_before>require 'spec_helper'

describe ::Trax::Core::Types::Struct do
  before(:all) do
    module MyFakeStructNamespace
      extend ::Trax::Core::Definitions

      struct :Locale do
        string :en, :default => ""
        string :da, :default => ""
        string :ca, :default => "eh"
      end
    end
  end

  subject { "::MyFakeStructNamespace::Locale".constantize.new(:en => "something") }

  it { expect(subject).to have_key("en") }
  it { expect(subject.en).to eq "something" }
  it { expect(subject.da).to eq "" }
  it { expect(subject.ca).to eq "eh" }

  context "unknown value" do
    subject { "::MyFakeStructNamespace::Locale".constantize.new(:blah => "something") }
    it { expect(subject).to_not respond_to(:blah) }
    it { expect(subject.en).to eq "" }
  end
end
<commit_msg>demonstrate nested struck not existing in spec<commit_after>require 'spec_helper'

describe ::Trax::Core::Types::Struct do
  before(:all) do
    module MyFakeStructNamespace
      extend ::Trax::Core::Definitions

      struct :Locale do
        string :en, :default => ""
        string :da, :default => ""
        string :ca, :default => "eh"

        struct :territories do
          string :en, :default => ["US", "GB"]
        end
      end
    end
  end

  subject { "::MyFakeStructNamespace::Locale".constantize.new(:en => "something") }

  it { expect(subject).to have_key("en") }
  it { expect(subject.en).to eq "something" }
  it { expect(subject.da).to eq "" }
  it { expect(subject.ca).to eq "eh" }
  it { expect(subject.territories.en).to eq ["US", "GB"] }

  context "unknown value" do
    subject { "::MyFakeStructNamespace::Locale".constantize.new(:blah => "something") }
    it { expect(subject).to_not respond_to(:blah) }
    it { expect(subject.en).to eq "" }
  end
end

{'fraction_non_alphanumeric': 0.15877437325905291, 'fraction_numerical': 0.0, 'mean_word_length': 3.255924170616114, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 14, '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': '4873962', 'n_tokens_mistral': 584, 'n_tokens_neox': 568, 'n_words': 138}