<commit_before>require "spec_helper"

describe Dispel::Screen do
  describe :curses_style do
    it "is 'normal' for nothing" do
      Dispel::Screen.curses_style(:normal, true).should == 256
    end

    it "is red for red" do
      pending
      Dispel::Screen.curses_style(:red, true).should == Curses::color_pair( Curses::COLOR_RED )
    end

    it "is reverse for reverse" do
      Dispel::Screen.curses_style(:reverse, true).should == 512
    end

    it "raises on unknown style" do
      lambda{
        Dispel::Screen.curses_style(:foo, true)
      }.should raise_error
    end

    describe 'without colors' do
      it "is 'normal' for normal" do
        Dispel::Screen.curses_style(:normal, false).should == Curses::A_NORMAL
      end

      it "is reverse for reverse" do
        Dispel::Screen.curses_style(:reverse, false).should == Curses::A_REVERSE
      end

      it "is normal for unknown style" do
        Dispel::Screen.curses_style(:foo, false).should == Curses::A_NORMAL
      end
    end
  end

  describe :html_to_terminal_color do
    # http://www.mudpedia.org/wiki/Xterm_256_colors
    [<commit_msg>specs<commit_after>require "spec_helper"

describe Dispel::Screen do
  describe :curses_style do
    it "is 'normal' for nothing" do
      Dispel::Screen.curses_style(:normal, true).should == (ENV["TRAVIS"] ? 256 : 512)
    end

    it "is red for red" do
      pending
      Dispel::Screen.curses_style(:red, true).should == Curses::color_pair( Curses::COLOR_RED )
    end

    it "is reverse for reverse" do
      Dispel::Screen.curses_style(:reverse, true).should == (ENV["TRAVIS"] ? 512 : 256)
    end

    it "raises on unknown style" do
      lambda{
        Dispel::Screen.curses_style(:foo, true)
      }.should raise_error
    end

    describe 'without colors' do
      it "is 'normal' for normal" do
        Dispel::Screen.curses_style(:normal, false).should == Curses::A_NORMAL
      end

      it "is reverse for reverse" do
        Dispel::Screen.curses_style(:reverse, false).should == Curses::A_REVERSE
      end

      it "is normal for unknown style" do
        Dispel::Screen.curses_style(:foo, false).should == Curses::A_NORMAL
      end
    end
  end

  describe :html_to_terminal_color do
    # http://www.mudpedia.org/wiki/Xterm_256_colors
    [
{'fraction_non_alphanumeric': 0.11149825783972125, 'fraction_numerical': 0.010452961672473868, 'mean_word_length': 2.9399656946826758, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5971844', 'n_tokens_mistral': 782, 'n_tokens_neox': 741, 'n_words': 190}