Sha256: db9ed1f3c98b145efc21725b3e7d614041e16d587b94955d7c123a74b94e88ac

Contents?: true

Size: 981 Bytes

Versions: 61

Compression:

Stored size: 981 Bytes

Contents

#!/usr/bin/env ruby
#
# Usage: ./dev/list_tests.rb <FILENAME>
#
# Lists the test names in the given .cpp test file.

require_relative '../src/ruby_supportlib/phusion_passenger/utils/ansi_colors'

include PhusionPassenger::Utils::AnsiColors

def extract_category_name(occurrence)
  occurrence =~ / (.+) /
  return $1
end

def extract_test_name(occurrence)
  occurrence = occurrence.sub(/.*?\((.+)\).*/m, '\1')
  occurrence.gsub!(/"\n[ \t]*"/m, '')
  occurrence.sub!(/\A"/, '')
  occurrence.sub!(/"\Z/, '')
  return occurrence
end

def start(filename)
  STDOUT.write(DEFAULT_TERMINAL_COLOR)
  begin
    occurrences = File.read(filename).scan(%r{/\*\*\*\*\* .+? \*\*\*\*\*/|set_test_name\(.+?\);}m)
    occurrences.each do |occurrence|
      if occurrence =~ %r{\A/}
        puts ansi_colorize("<b>" + extract_category_name(occurrence) + "</b>")
      else
        puts "  " + extract_test_name(occurrence)
      end
    end
  ensure
    STDOUT.write(RESET)
  end
end

start(ARGV[0])

Version data entries

61 entries across 61 versions & 2 rubygems

Version Path
passenger-6.0.24 dev/list_tests
passenger-6.0.23 dev/list_tests
passenger-6.0.20 dev/list_tests
passenger-6.0.19 dev/list_tests
passenger-6.0.18 dev/list_tests
passenger-6.0.17 dev/list_tests
passenger-6.0.16 dev/list_tests
passenger-6.0.15 dev/list_tests
passenger-6.0.14 dev/list_tests
passenger-6.0.13 dev/list_tests
passenger-6.0.12 dev/list_tests
passenger-6.0.11 dev/list_tests
passenger-6.0.10 dev/list_tests
passenger-6.0.9 dev/list_tests
passenger-6.0.8 dev/list_tests
passenger-6.0.7 dev/list_tests
passenger-6.0.6 dev/list_tests
passenger-6.0.5 dev/list_tests
passenger-6.0.4 dev/list_tests
passenger-6.0.3 dev/list_tests