<commit_before>#!/usr/bin/env ruby

require_relative '../spec_helper'
require_relative '../../lib/wavefront-cli/controller'

# Be sure the CLI behaves properly when people ask for help
#
class WavefrontCliHelpTest < MiniTest::Test
  def test_no_args
    capture_io { WavefrontCliController.new([]) }
  rescue SystemExit => e
    assert_equal(1, e.status)
    assert_match(/^Usage/, e.message)
    assert_match(/^  \w+ --version$/, e.message)
    assert_match(/^  \w+ --help$/, e.message)
  end

  def test_version
    capture_io { WavefrontCliController.new(%w[--version]) }
  rescue SystemExit => e
    assert_equal(1, e.status)
    assert_match(/^\d+\.\d+\.\d+$/, e.message)
  end

  def test_help
    capture_io { WavefrontCliController.new(%w[--help]) }
  rescue SystemExit => e
    assert_equal(1, e.status)
    assert_match(/^Commands:$/, e.message)
    CMDS.each { |cmd| assert_match(/^  #{cmd} /, e.message) }
  end

  def test_command_help
    CMDS.each do |cmd|
      begin
        capture_io { WavefrontCliController.new([cmd, '--help']) }
      rescue SystemExit => e
        assert(e.message.split("\n").map(&:size).max <= TW)
        assert_equal(1, e.status)<commit_msg>check we're not in development mode in the CI pipeline<commit_after>#!/usr/bin/env ruby

require_relative '../spec_helper'
require_relative '../../lib/wavefront-cli/controller'

# Be sure the CLI behaves properly when people ask for help
#
class WavefrontCliHelpTest < MiniTest::Test
  def test_development_mode
    refute defined?(DEVELOPMENT) if ENV['CI']
  end

  def test_no_args
    capture_io { WavefrontCliController.new([]) }
  rescue SystemExit => e
    assert_equal(1, e.status)
    assert_match(/^Usage/, e.message)
    assert_match(/^  \w+ --version$/, e.message)
    assert_match(/^  \w+ --help$/, e.message)
  end

  def test_version
    capture_io { WavefrontCliController.new(%w[--version]) }
  rescue SystemExit => e
    assert_equal(1, e.status)
    assert_match(/^\d+\.\d+\.\d+$/, e.message)
  end

  def test_help
    capture_io { WavefrontCliController.new(%w[--help]) }
  rescue SystemExit => e
    assert_equal(1, e.status)
    assert_match(/^Commands:$/, e.message)
    CMDS.each { |cmd| assert_match(/^  #{cmd} /, e.message) }
  end

  def test_command_help
    CMDS.each do |cmd|
      begin
        capture_io { WavefrontCliController.new([cmd, '--help']) }
      rescue SystemExit => e
        assert(e.message.split("\n").map(&:size).max <= TW)
        assert_equal(1, e.status)
{'fraction_non_alphanumeric': 0.15168539325842698, 'fraction_numerical': 0.0032102728731942215, 'mean_word_length': 3.168896321070234, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '4653563', 'n_tokens_mistral': 886, 'n_tokens_neox': 852, 'n_words': 185}