<commit_before>require 'spec/spec_helper'

describe ROXML, "encoding" do
  class TestResult
    include ROXML
    xml_accessor :message
  end

  context "when provided non-latin characters" do
    it "should output those characters as input via methods" do
      res = TestResult.new
      res.message = "sadfk одловыа jjklsd " #random russian  and english charecters
      res.to_xml.at('message').inner_text.should == "sadfk одловыа jjklsd "
    end

    it "should output those characters as input via xml" do
      res = TestResult.from_xml("<test_result><message>sadfk одловыа jjklsd </message></test_result>")
      res.to_xml.at('message').inner_text.should == "sadfk одловыа jjklsd "
    end
  end
end<commit_msg>Expand on encoding spec a bit to accomodate libxml idosyncracies<commit_after>require 'spec/spec_helper'

describe ROXML, "encoding" do
  class TestResult
    include ROXML
    xml_accessor :message
  end

  context "when provided non-latin characters" do
    it "should output those characters as input via methods" do
      res = TestResult.new
      res.message = "sadfk одловыа jjklsd " #random russian  and english charecters
      doc = ROXML::XML::Document.new
      doc.root = res.to_xml
      if defined?(Nokogiri)
        doc.at('message').inner_text
      else
        doc.find_first('message').inner_xml
      end.should == "sadfk одловыа jjklsd "
    end

    it "should output those characters as input via xml" do
      res = TestResult.from_xml("<test_result><message>sadfk одловыа jjklsd </message></test_result>")
      doc = ROXML::XML::Document.new
      doc.root = res.to_xml
      if defined?(Nokogiri)
        doc.at('message').inner_text
      else
        doc.find_first('message').inner_xml
      end.should == "sadfk одловыа jjklsd "
    end
  end
end
{'fraction_non_alphanumeric': 0.09005002779321845, 'fraction_numerical': 0.0, 'mean_word_length': 3.186046511627907, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 13}, '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': '6855505', 'n_tokens_mistral': 598, 'n_tokens_neox': 608, 'n_words': 160}