source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/cli/formatters/compact.rb | Ruby | mit | 19 | main | 9,721 | # lib/tryouts/cli/formatters/compact.rb
#
# frozen_string_literal: true
class Tryouts
class CLI
# Compact single-line formatter focused on results
class CompactFormatter
include FormatterInterface
def initialize(options = {})
super
@show_debug = options.fetch(:debug, false)
... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/cli/modes/generate.rb | Ruby | mit | 19 | main | 660 | # lib/tryouts/cli/modes/generate.rb
#
# frozen_string_literal: true
class Tryouts
class CLI
class GenerateMode
def initialize(file, testrun, options, output_manager, translator)
@file = file
@testrun = testrun
@options = options
@output_manager = outp... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/cli/modes/inspect.rb | Ruby | mit | 19 | main | 1,658 | # lib/tryouts/cli/modes/inspect.rb
#
# frozen_string_literal: true
class Tryouts
class CLI
class InspectMode
def initialize(file, testrun, options, output_manager, translator)
@file = file
@testrun = testrun
@options = options
@output_manager = output... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/translators/minitest_translator.rb | Ruby | mit | 19 | main | 6,262 | # lib/tryouts/translators/minitest_translator.rb
#
# frozen_string_literal: true
class Tryouts
module Translators
# Translates Tryouts test files to Minitest format
#
# IMPORTANT: Context Mode Differences
# ==================================
#
# Tryouts supports two context modes that behave ... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/translators/rspec_translator.rb | Ruby | mit | 19 | main | 5,776 | # lib/tryouts/translators/rspec_translator.rb
#
# frozen_string_literal: true
class Tryouts
module Translators
# Translates Tryouts test files to RSpec format
#
# IMPORTANT: Context Mode Differences
# ==================================
#
# Tryouts supports two context modes that behave differ... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/registry.rb | Ruby | mit | 19 | main | 1,838 | # lib/tryouts/expectation_evaluators/registry.rb
#
# frozen_string_literal: true
require_relative 'expectation_result'
require_relative 'base'
require_relative 'regular'
require_relative 'exception'
require_relative 'boolean'
require_relative 'true'
require_relative 'false'
require_relative 'result_type'
require_relat... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/performance_time.rb | Ruby | mit | 19 | main | 3,572 | # lib/tryouts/expectation_evaluators/performance_time.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for performance time expectations using syntax: #=%> milliseconds
#
# PURPOSE:
# - Validates that test execution time meets performa... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/regex_match.rb | Ruby | mit | 19 | main | 2,808 | # lib/tryouts/expectation_evaluators/regex_match.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for regex match expectations using syntax: #=~> /pattern/
#
# PURPOSE:
# - Validates that the test result matches a regular expression pa... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/non_nil.rb | Ruby | mit | 19 | main | 2,784 | # lib/tryouts/expectation_evaluators/non_nil.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for non-nil expectations using syntax: #=*>
#
# PURPOSE:
# - Validates that the test result is not nil and no exception occurred
# - Prov... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/result_type.rb | Ruby | mit | 19 | main | 3,281 | # lib/tryouts/expectation_evaluators/result_type.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for result type expectations using syntax: #=:> ClassName
#
# PURPOSE:
# - Validates that the test result is an instance of the expected ... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/base.rb | Ruby | mit | 19 | main | 4,209 | # lib/tryouts/expectation_evaluators/base.rb
#
# frozen_string_literal: true
class Tryouts
module ExpectationEvaluators
# Base class for all expectation evaluators
class Base
attr_reader :expectation, :test_case, :context
# @param expectation_type [Symbol] the type of expectation to check
... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/regular.rb | Ruby | mit | 19 | main | 2,930 | # lib/tryouts/expectation_evaluators/regular.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for standard equality expectations using syntax: #=> expression
#
# PURPOSE:
# - Validates that test result equals the evaluated expectation ... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/true.rb | Ruby | mit | 19 | main | 2,452 | # lib/tryouts/expectation_evaluators/true.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for boolean true expectations using syntax: #==> expression
#
# PURPOSE:
# - Validates that an expression evaluates to exactly true (not truthy)... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/false.rb | Ruby | mit | 19 | main | 2,636 | # lib/tryouts/expectation_evaluators/false.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for boolean false expectations using syntax: #=/=> expression
#
# PURPOSE:
# - Validates that an expression evaluates to exactly false (not fal... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/intentional_failure.rb | Ruby | mit | 19 | main | 3,335 | # lib/tryouts/expectation_evaluators/intentional_failure.rb
#
# frozen_string_literal: true
require_relative 'base'
require_relative 'regular'
require_relative '../test_case'
class Tryouts
module ExpectationEvaluators
# Evaluator for intentional failure expectations using syntax: #=<> expression
#
# PUR... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/expectation_result.rb | Ruby | mit | 19 | main | 2,906 | # lib/tryouts/expectation_evaluators/expectation_result.rb
#
# frozen_string_literal: true
class Tryouts
module ExpectationEvaluators
# Extensible container for evaluation context data
#
# Provides immutable data structure for passing test results and timing data to evaluators.
# Uses Data.define for... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/output.rb | Ruby | mit | 19 | main | 4,356 | # lib/tryouts/expectation_evaluators/output.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for output expectations using syntax: #=1> content, #=2> content
#
# PURPOSE:
# - Validates that stdout (pipe 1) or stderr (pipe 2) contains e... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/boolean.rb | Ruby | mit | 19 | main | 2,719 | # lib/tryouts/expectation_evaluators/boolean.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
# Evaluator for flexible boolean expectations using syntax: #=|> expression
#
# PURPOSE:
# - Validates that an expression evaluates to either true or fal... |
github | delano/tryouts | https://github.com/delano/tryouts | lib/tryouts/expectation_evaluators/exception.rb | Ruby | mit | 19 | main | 3,038 | # lib/tryouts/expectation_evaluators/exception.rb
#
# frozen_string_literal: true
require_relative 'base'
class Tryouts
module ExpectationEvaluators
class Exception < Base
def self.handles?(expectation_type)
expectation_type == :exception
end
def evaluate(_actual_result = nil, caught_... |
github | delano/tryouts | https://github.com/delano/tryouts | try/test_helper.rb | Ruby | mit | 19 | main | 526 | # try/test_helper.rb
#
# frozen_string_literal: true
# Coverage is handled by the CLI entry point to avoid double initialization
# Require the main library
require_relative '../lib/tryouts'
# Test utilities and common setup
module TestHelper
def self.silence_warnings
old_verbose = $VERBOSE
$VERBOSE = ni... |
github | delano/tryouts | https://github.com/delano/tryouts | try/demo_live_try.rb | Ruby | mit | 19 | main | 5,460 | # try/demo_live_try.rb
#
# frozen_string_literal: true
# Setup
puts 'Starting comprehensive live formatter demo...'
puts 'This demo showcases real-time status updates during test execution'
## TEST: Basic arithmetic operations
puts 'Testing basic arithmetic...'
sleep(0.1) # Small delay to see status update
2 + 2
#=<... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/test_batch_setup_try.rb | Ruby | mit | 19 | main | 861 | # try/core/test_batch_setup_try.rb
#
# frozen_string_literal: true
# Tests for TestBatch setup execution logic
require_relative '../../lib/tryouts'
@test_file = 'try/core/basic_syntax_try.rb'
@parser = Tryouts::LegacyParser.new(@test_file)
@testrun = @parser.parse
## TEST: Parser successfully parses test file
@test... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/basic_syntax_with_comments_try.rb | Ruby | mit | 19 | main | 979 | # try/core/basic_syntax_with_comments_try.rb
#
# frozen_string_literal: true
# Tests for basic tryout syntax, expectations, and setup/teardown
# A friendly output message
puts 'If you see this the setup ran correctly.'
# Let's have another comment here to try to
# throw the parser off.
# TEST 1: test matches result ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/basic_syntax_try.rb | Ruby | mit | 19 | main | 906 | # try/core/basic_syntax_try.rb
#
# frozen_string_literal: true
# Tests for basic tryout syntax, expectations, and setup/teardown
puts 'If you see this the setup ran correctly.'
# TEST 1: test matches result with expectation
a = 1 + 1
#=> 2
## TEST 2: comments, tests, and expectations can
## contain multiple lines
a... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/single_hash_test_try.rb | Ruby | mit | 19 | main | 351 | # try/core/single_hash_test_try.rb
#
# frozen_string_literal: true
# This is a setup comment
setup_value = "setup"
# This should be a test description
result = 1 + 1
#=> 2
# Another test with single hash
"hello".upcase
#=> "HELLO"
## This is still a double hash description
[1, 2, 3].length
#=> 3
# Cleanup comment ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/teardown_handling_try.rb | Ruby | mit | 19 | main | 690 | # try/core/teardown_handling_try.rb
#
# frozen_string_literal: true
# Tests for teardown detection functionality
require_relative '../../lib/tryouts'
test_file = 'try/core/basic_syntax_try.rb'
@parser = Tryouts::LegacyParser.new(test_file)
## TEST: Parser can detect teardown in basic syntax file
testrun = @parser.... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/error_handling_try.rb | Ruby | mit | 19 | main | 591 | # try/core/error_handling_try.rb
#
# frozen_string_literal: true
# Tests for error handling and deliberate failures
## Test failure example (intentional failure)
1 + 1
#=<> 3
## Another failing test (intentional failure)
'hello'.upcase
#=<> "GOODBYE"
## Divide by zero exception test
1/0
#=!> error.is_a?(ZeroDivisio... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/concurrency_try.rb | Ruby | mit | 19 | main | 4,251 | # try/core/concurrency_try.rb
#
# frozen_string_literal: true
# Tests for thread safety and atomic operations in TestResultAggregator
require_relative '../../lib/tryouts/test_result_aggregator'
# Setup: Create mock test case and result packet classes
class MockTestCase
attr_reader :description, :line_range, :path
... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/constant_shadowing_try.rb | Ruby | mit | 19 | main | 2,647 | # try/core/constant_shadowing_try.rb
#
# frozen_string_literal: true
#
# Tests for constant shadowing edge cases in type expectations
# Verifies that class type expectations work correctly even when
# class constants are shadowed by local variables or methods
# Setup classes used in tests
class CustomTestClass
def ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/section_boundaries_try.rb | Ruby | mit | 19 | main | 1,643 | # try/core/section_boundaries_try.rb
#
# frozen_string_literal: true
# Tests for proper section boundary detection - setup, test, teardown
# Setup section with various comment patterns that should NOT create new blocks
puts "Setup starting"
@setup_var = "setup_value"
# Regular comments in setup should be fine
# Mult... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/single_hash_comments_try.rb | Ruby | mit | 19 | main | 502 | # try/core/single_hash_comments_try.rb
#
# frozen_string_literal: true
# Setup with single hash comments should not break parsing
require_relative '../../lib/tryouts'
# This is a single hash comment in setup
# Another single hash comment
@variable = 'setup_value'
## TEST: Single hash comments in setup don't interfer... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/shared_context_try.rb | Ruby | mit | 19 | main | 1,653 | # try/core/shared_context_try.rb
#
# frozen_string_literal: true
# Test demonstrating shared context behavior with instance variables
# In shared context mode (default), instance variables persist across all test cases
# This test validates the core behavior of Tryouts' execution context
## Test 1: Set instance varia... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/advanced_syntax_try.rb | Ruby | mit | 19 | main | 1,434 | # try/core/advanced_syntax_try.rb
#
# frozen_string_literal: true
# Tests for advanced features: exceptions, helper methods, multiple expectations
puts 'if you can see this, step2 setup succeeded'
def example_of_an_inline_test_helper_method
'I am helping'
end
## some addition
a = 1
b = 2
a + b + 1
# => 4
## Mult... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/basic_syntax_with_disruptive_comments_try.rb | Ruby | mit | 19 | main | 1,258 | # try/core/basic_syntax_with_disruptive_comments_try.rb
#
# frozen_string_literal: true
# Tests for basic tryout syntax, expectations, and setup/teardown
## SETUP
# This class that we won't use is helpful for testing the parser's ability
# to correctly identify tryouts testcases from random comments and other code.
... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/setup_failure_exit_code_try.rb | Ruby | mit | 19 | main | 1,770 | # try/core/setup_failure_exit_code_try.rb
#
# frozen_string_literal: true
# Test that setup failures return non-zero exit codes
# This test verifies the fix for issue where setup failures returned 0 instead of proper error codes
require_relative '../../lib/tryouts'
## Test that setup failures are properly tracked in... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/fresh_context_try.rb | Ruby | mit | 19 | main | 2,079 | # try/core/fresh_context_try.rb
#
# frozen_string_literal: true
# Test demonstrating fresh context behavior with instance variables
# In fresh context mode (--no-shared-context), each test case gets a new execution context
# This test validates the isolation behavior of Tryouts' fresh context execution
#
# IMPORTANT: ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/class_functionality_try.rb | Ruby | mit | 19 | main | 3,625 | # try/core/class_functionality_try.rb
#
# frozen_string_literal: true
# Tests for core Tryouts class functionality
require_relative '../test_helper'
## TEST: TRYOUTS_LIB_HOME constant is defined
defined?(TRYOUTS_LIB_HOME)
#=> "constant"
## TEST: TRYOUTS_LIB_HOME points to lib directory
TRYOUTS_LIB_HOME.end_with?('li... |
github | delano/tryouts | https://github.com/delano/tryouts | try/core/fails_mode_try.rb | Ruby | mit | 19 | main | 270 | # try/core/fails_mode_try.rb
#
# frozen_string_literal: true
# Tests for fails mode functionality
# This should pass
result1 = 1 + 1
#=> 2
# This should fail
result2 = 2 + 2
#=<> 5
# This should pass
result3 = 3 * 3
#=> 9
# This should fail
result4 = 4 * 4
#=<> 20 |
github | delano/tryouts | https://github.com/delano/tryouts | try/translators/rspec_translator_try.rb | Ruby | mit | 19 | main | 8,227 | # try/translators/rspec_translator_try.rb
#
# frozen_string_literal: true
# Tests for RSpecTranslator functionality
require_relative '../test_helper'
require_relative '../../lib/tryouts/translators/rspec_translator'
require_relative '../../lib/tryouts/test_case'
## TEST: Translator initializes successfully when rspe... |
github | delano/tryouts | https://github.com/delano/tryouts | try/translators/minitest_translator_try.rb | Ruby | mit | 19 | main | 9,478 | # try/translators/minitest_translator_try.rb
#
# frozen_string_literal: true
# Tests for MinitestTranslator functionality
require_relative '../test_helper'
require_relative '../../lib/tryouts/translators/minitest_translator'
require_relative '../../lib/tryouts/test_case'
## TEST: Translator initializes successfully ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/regressions/setup_error_exit_code_try.rb | Ruby | mit | 19 | main | 1,210 | # try/regressions/setup_error_exit_code_try.rb
#
# frozen_string_literal: true
## Test that setup failures result in proper exit code 1
##
## This regression test replicates the issue where setup failures
## would incorrectly exit with code 0 instead of 1 in agent mode.
# Create a test file that has a setup failure s... |
github | delano/tryouts | https://github.com/delano/tryouts | try/regressions/exit_code_fix_try.rb | Ruby | mit | 19 | main | 552 | # try/regressions/exit_code_fix_try.rb
#
# frozen_string_literal: true
# Test that setup failures result in non-zero exit code
# Create a test file with setup failure
File.write('test_setup_failure.try.rb', "
# Setup that fails
undefined_variable # This will cause NameError
## Test case
puts 'This should not run'
... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/performance_timing_try.rb | Ruby | mit | 19 | main | 574 | # try/expectations/performance_timing_try.rb
#
# frozen_string_literal: true
## TEST: Very fast operation should pass loose timing
1 + 1
#=%> 1 # Allow up to 1ms (should easily pass)
## TEST: Sleep operation with reasonable expectation
sleep(0.01) # Sleep for 10ms
#=%> 15 # Expect around 15ms (allows 10-11ms wi... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/output_expectations_try.rb | Ruby | mit | 19 | main | 979 | # try/expectations/output_expectations_try.rb
#
# frozen_string_literal: true
## TEST: Simple stdout string contains
puts "Hello, World!"
#=1> "Hello"
## TEST: Stdout regex pattern match
puts "Testing output capture: 12345"
#=1> /Testing.*\d+/
## TEST: Multiple stdout expectations
puts "Line 1"; puts "Line 2"
#=1> "... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/multiple_expectations_try.rb | Ruby | mit | 19 | main | 1,859 | # try/expectations/multiple_expectations_try.rb
#
# frozen_string_literal: true
## TEST1: Returns an array, has multiple expectations
[1, 2, 3]
#=> [1, 2, 3]
#==> result.class == Array
#==> result.size == 3
#==> result.length > 2
## TEST2: Boolean true expectations work correctly
[1, 2, 3]
#==> result.length == 3 # ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/intentional_failure_try.rb | Ruby | mit | 19 | main | 877 | # try/expectations/intentional_failure_try.rb
#
# frozen_string_literal: true
## TEST: Basic intentional failure - should pass when expectation fails
1 + 1
#=<> 3 # Pass: 1+1 ≠ 3, so intentional failure succeeds
## TEST: String intentional failure - should pass when string doesn't contain expected
"hello world"
#=<>... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/non_nil_expectations_try.rb | Ruby | mit | 19 | main | 662 | # try/expectations/non_nil_expectations_try.rb
#
# frozen_string_literal: true
# Tests for the non-nil expectation syntax
puts 'Testing non-nil expectations...'
## TEST 1: Non-nil string passes
"hello world"
#=*>
## TEST 2: Non-nil number passes
42
#=*>
## TEST 3: Non-nil array passes
[1, 2, 3]
#=*>
## TEST 4: No... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/combined_features_try.rb | Ruby | mit | 19 | main | 842 | # try/expectations/combined_features_try.rb
#
# frozen_string_literal: true
## TEST: Intentional failure with output - stderr should NOT contain specific text
puts "This goes to stdout"
$stderr.puts "Different error message"
#=<> "This text should not be in stderr" # Intentional failure on stdout content
#=2> "Differ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/expectations/comprehensive_expectations_try.rb | Ruby | mit | 19 | main | 707 | # try/expectations/comprehensive_expectations_try.rb
#
# frozen_string_literal: true
## TEST: Regular expectation with clean expected display
[1, 2, 3]
#=> [1, 2, 3]
## TEST: Boolean true expectation
[1, 2, 3]
#==> result.length == 3
## TEST: Boolean false expectation
[1, 2, 3]
#=/=> result.empty?
## TEST: Boolean ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/formatters/token_budget_try.rb | Ruby | mit | 19 | main | 6,357 | # try/formatters/token_budget_try.rb
#
# frozen_string_literal: true
# Comprehensive tests for TokenBudget class
# Tests token estimation, budget management, and smart truncation
require_relative '../../lib/tryouts/cli/formatters/token_budget'
## Test default initialization
@default_budget = Tryouts::CLI::TokenBudge... |
github | delano/tryouts | https://github.com/delano/tryouts | try/formatters/failure_summary_try.rb | Ruby | mit | 19 | main | 6,728 | # try/formatters/failure_summary_try.rb
#
# frozen_string_literal: true
## TEST: FailureCollector can be created
collector = Tryouts::FailureCollector.new
collector.class
#=> Tryouts::FailureCollector
## TEST: FailureCollector starts empty
collector = Tryouts::FailureCollector.new
collector.any_failures?
#=> false
#... |
github | delano/tryouts | https://github.com/delano/tryouts | try/formatters/simple_agent_test_try.rb | Ruby | mit | 19 | main | 1,052 | # try/formatters/simple_agent_test_try.rb
#
# frozen_string_literal: true
# Simple agent mode functionality test
require_relative '../../lib/tryouts/cli/formatters/agent'
require_relative '../../lib/tryouts/cli/formatters/token_budget'
## Test TokenBudget initialization
@budget = Tryouts::CLI::TokenBudget.new(100)
@... |
github | delano/tryouts | https://github.com/delano/tryouts | try/formatters/console_formatting_try.rb | Ruby | mit | 19 | main | 3,176 | # try/formatters/console_formatting_try.rb
#
# frozen_string_literal: true
# Tests for Console module ANSI colors and formatting
require_relative '../test_helper'
require_relative '../../lib/tryouts/console'
## TEST: ANSI color constants are defined
Tryouts::Console::COLOURS.keys.include?(:red)
#=> true
## TEST: Red... |
github | delano/tryouts | https://github.com/delano/tryouts | try/formatters/agent_formatter_try.rb | Ruby | mit | 19 | main | 2,995 | # try/formatters/agent_formatter_try.rb
#
# frozen_string_literal: true
# Comprehensive tests for AgentFormatter functionality
# Tests agent-optimized output modes for LLM context management
require_relative '../../lib/tryouts/cli/formatters/agent'
require_relative '../../lib/tryouts/cli/formatters/token_budget'
## ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/safety/batch_setup_with_comments_try.rb | Ruby | mit | 19 | main | 517 | # try/safety/batch_setup_with_comments_try.rb
#
# frozen_string_literal: true
puts "start of setup"
require_relative '../../lib/tryouts'
# An arbitrary comment in the setup should not affect how the setup or testcases are parsed.
test_file = 'try/safety/batch_setup_with_comments_try.rb'
puts 'end of setup'
# We inst... |
github | delano/tryouts | https://github.com/delano/tryouts | try/safety/batch_setup_familia_failure_try.rb | Ruby | mit | 19 | main | 399 | # try/safety/batch_setup_familia_failure_try.rb
#
# frozen_string_literal: true
require_relative '../test_helper'
# This is parse of the batch setup
@ret = Bone.new('atoken2', 'smurf', 1001)
puts 'end of setup'
## Familia::String#increment
@ret.token
#=> 'atoken2'
## Familia::String#incrementby
@ret.name
#=> 'smurf... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/complex_line_number_try.rb | Ruby | mit | 19 | main | 2,455 | # try/debug/complex_line_number_try.rb
#
# frozen_string_literal: true
# Complex test with heredocs and varied comment patterns to trigger line number issues
# Large setup block with heredocs and complex patterns
puts "Setup starting"
# Heredoc in setup - this might confuse the enhanced parser
sql_query = <<~SQL
S... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/parser_comparison.rb | Ruby | mit | 19 | main | 5,969 | # try/debug/parser_comparison.rb
#
# frozen_string_literal: true
#!/usr/bin/env ruby
# Parser comparison testing script
# Compares outputs of LegacyParser vs EnhancedParser
require_relative '../../lib/tryouts/parsers/legacy_parser'
require_relative '../../lib/tryouts/parsers/enhanced_parser'
class ParserComparison
... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/exception_regex_issues_try.rb | Ruby | mit | 19 | main | 1,187 | # try/debug/exception_regex_issues_try.rb
#
# frozen_string_literal: true
# Test file to demonstrate actual issues with exception expectations and regex matching
## TEST: Exception type expectation should check the class, not fail with error
raise ArgumentError, "wrong argument type"
#=:> ArgumentError
## TEST: Rege... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/teardown_exit_handling_try.rb | Ruby | mit | 19 | main | 290 | # try/debug/teardown_exit_handling_try.rb
#
# frozen_string_literal: true
# Test that teardown handles SystemExit gracefully
## Test runs normally
1 + 1
#=> 2
## Another test
2 + 2
#=> 4
# Teardown calls exit - should be caught, tests should still pass
puts "Teardown with exit"
exit 0 |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/parser_boundary_regression_try.rb | Ruby | mit | 19 | main | 1,154 | # try/debug/parser_boundary_regression_try.rb
#
# frozen_string_literal: true
# Regression tests for parser section boundary detection
# These tests verify that both parsers handle identical boundary cases correctly
# Minimal reproduction of the boundary bug
puts "Setup line 1"
@critical_var = "critical_value"
## Th... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/test_malformed_detection.rb | Ruby | mit | 19 | main | 403 | # try/debug/test_malformed_detection.rb
#
# frozen_string_literal: true
# Test malformed expectation detection
## TEST: Valid expectation should work
result = 1 + 1
#=> 2
## TEST: These should trigger malformed expectation warnings
another_result = 2 + 2
# = > 4
# =x> invalid
## TEST: Natural language should be fin... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/comments_with_equals_sign_try.rb | Ruby | mit | 19 | main | 390 | # try/debug/comments_with_equals_sign_try.rb
#
# frozen_string_literal: true
require_relative '../test_helper'
# This is parse of the batch setup = 1
@ret = Bone.new('atoken2', 'smurf', 1001)
# Tests for the non-nil expectation syntax (#=*>)
puts 'end of setup'
## Familia::String#increment #=$BOGUS$>
@ret.token
#=>... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/broken_testcase_syntax_try.rb | Ruby | mit | 19 | main | 484 | # try/debug/broken_testcase_syntax_try.rb
#
# frozen_string_literal: true
# Intentionally incorrect expectation syntax should still be parsed
# in a way that doesn't lump everything into a setup section up to
# the first test case with a valid expectation.
## First broken expectation
1 + 1
#=$BOGUS$> 2
## Second bro... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/test_inline_comment_fix.rb | Ruby | mit | 19 | main | 424 | # try/debug/test_inline_comment_fix.rb
#
# frozen_string_literal: true
# Test inline comment exclusion
## TEST: Inline comments should not be treated as expectations
result = 1 + 1 # => This should NOT be treated as an expectation
result
#=> 2
## TEST: Natural language comments with equals should work
# This commen... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/prism_inhouse_parser_prototype.rb | Ruby | mit | 19 | main | 4,993 | # try/debug/prism_inhouse_parser_prototype.rb
#
# frozen_string_literal: true
# Prototype implementation of PrismInhouseParser
# Demonstrates hybrid approach using Prism's inhouse comment extraction
require 'prism'
class PrismInhouseParserPrototype
def initialize(source_path)
@source_path = source_path
@so... |
github | delano/tryouts | https://github.com/delano/tryouts | try/debug/setup_exit_handling_try.rb | Ruby | mit | 19 | main | 245 | # try/debug/setup_exit_handling_try.rb
#
# frozen_string_literal: true
# Test that setup handles SystemExit gracefully
# Setup calls exit - should be caught and reported
puts "Setup with exit"
exit 0
## This test should never run
1 + 1
#=> 2 |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/batch_setup_safety_no_autorun.rb | Ruby | mit | 19 | main | 501 | # try/continue-on-error/batch_setup_safety_no_autorun.rb
#
# frozen_string_literal: true
#
# Tests for extenuating circumstances
require_relative '../../lib/tryouts'
test_file = 'foo/bar/setup_baz_try.rb'
Tryouts::LegacyParser.new(test_file)
## TEST: We never get to this testcase b/c setup fails
raise SystemExit
#=<... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/line_number_debug_noautorun.rb | Ruby | mit | 19 | main | 5,337 | # try/continue-on-error/line_number_debug_noautorun.rb
#
# frozen_string_literal: true
#!/usr/bin/env ruby
# Debug script to analyze line number behavior in the tryouts parser
# This file helps identify the source of the off-by-one line number bug
require_relative '../../lib/tryouts/parsers/legacy_parser'
require_rel... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/circuit_breaker_try.rb | Ruby | mit | 19 | main | 964 | # try/continue-on-error/circuit_breaker_try.rb
#
# frozen_string_literal: true
# Circuit breaker test - create multiple failing tests to trigger circuit breaker
## TEST: First failure
raise "intentional error 1"
#=<> nil
## TEST: Second failure
raise "intentional error 2"
#=<> nil
## TEST: Third failure
raise "inte... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/line_number_regression_try.rb | Ruby | mit | 19 | main | 1,056 | # try/continue-on-error/line_number_regression_try.rb
#
# frozen_string_literal: true
# Test file to identify line number discrepancies between parsers
# NOTE: Some tests are designed to fail to verify accurate error line reporting
# Setup block - 15 lines to test offset calculation
puts "Starting setup"
x = 1
y = 2
... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/type_expectations_try.rb | Ruby | mit | 19 | main | 1,424 | # try/continue-on-error/type_expectations_try.rb
#
# frozen_string_literal: true
## TEST: Result type expectations work correctly
"hello world"
#=:> String
## TEST: Array type check
[1, 2, 3]
#=:> Array
## TEST: Integer type check
42
#=:> Integer
## TEST: Should fail with wrong type
"hello"
#=:<> Integer
## TEST: ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/line_number_real_test_noautorun.rb | Ruby | mit | 19 | main | 4,882 | # try/continue-on-error/line_number_real_test_noautorun.rb
#
# frozen_string_literal: true
#!/usr/bin/env ruby
# Real test to verify line number consistency fix in practice
# This creates actual failing tests and checks error output for consistent line numbers
require_relative '../../lib/tryouts/parsers/legacy_parser... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/agent_friendly_warnings.try.rb | Ruby | mit | 19 | main | 383 | # try/continue-on-error/agent_friendly_warnings.try.rb
#
# frozen_string_literal: true
## Test with proper description
result = 1 + 1
#=> 2
# This creates an unnamed test that should trijgger a warning
value = "hello world"
#=> "hello world"
## Another properly described test
calculation = 3 * 4
#=> 12
## TEST: Arr... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/basic_syntax_with_heredoc_no_autorun.rb | Ruby | mit | 19 | main | 952 | # try/continue-on-error/basic_syntax_with_heredoc_no_autorun.rb
#
# frozen_string_literal: true
# Tests for basic tryout syntax, expectations, and setup/teardown
# A friendly output message
@setup_text = <<~COMMENT
puts 'This puts is inside of a heredoc in the setup.'
# TEST 1: test matches result with expectation
a ... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/line_number_edge_cases_debug_noautorun.rb | Ruby | mit | 19 | main | 5,257 | # try/continue-on-error/line_number_edge_cases_debug_noautorun.rb
#
# frozen_string_literal: true
#!/usr/bin/env ruby
# Debug script for edge cases that might trigger line number off-by-one bugs
# This tests scenarios that could cause inconsistencies in line number tracking
require_relative '../../lib/tryouts/parsers... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/failure_formatting_try.rb | Ruby | mit | 19 | main | 535 | # try/continue-on-error/failure_formatting_try.rb
#
# frozen_string_literal: true
## TEST: Regular expectation failure (the lists do not match)
[1, 2, 3]
#=> [4, 5, 6]
## TEST: Boolean true expectation failure (the list is NOT empty)
[1, 2, 3]
#==> result.empty?
## TEST: Boolean false expectation failure (the list I... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/non_nil_failure_cases_no_autorun.rb | Ruby | mit | 19 | main | 296 | # try/continue-on-error/non_nil_failure_cases_no_autorun.rb
#
# frozen_string_literal: true
# Tests for non-nil expectation failures (intentional failures for testing)
puts 'Testing non-nil expectation failure cases...'
## TEST 1: Nil should fail
nil
#=*>
puts 'Failure case tests completed' |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/regex_expectations_try.rb | Ruby | mit | 19 | main | 478 | # try/continue-on-error/regex_expectations_try.rb
#
# frozen_string_literal: true
# NOTE: These fail in the legacy parser
## TEST: Simple regex pattern match
"hello world"
#=~> /hello/
## TEST: Email pattern match
"user@example.com"
#=~> /\A[^@]+@[^@]+\.[^@]+\z/
## TEST: Number pattern in string
"Phone: 555-1234"
#... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/batch_teardown_safety_on_autorun.rb | Ruby | mit | 19 | main | 480 | # try/continue-on-error/batch_teardown_safety_on_autorun.rb
#
# frozen_string_literal: true
#
# Tests for extenuating circumstances
require_relative '../../lib/tryouts'
puts <<MESSAGE
We should see this setup message and the testcase in this file should pass.
The teardown should fail because we intentionally caused a... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/batch_safety_run_no_autorun.rb | Ruby | mit | 19 | main | 1,108 | # try/continue-on-error/batch_safety_run_no_autorun.rb
#
# frozen_string_literal: true
#
# Tests for extenuating circumstances
# NOTE: These tests are expected to show as ERRORS in the output since they
# verify that dangerous exceptions are caught and handled gracefully.
#
# Success is measured by:
# 1. All tests exe... |
github | delano/tryouts | https://github.com/delano/tryouts | try/continue-on-error/line_number_analysis_and_fix_noautorun.rb | Ruby | mit | 19 | main | 5,540 | # try/continue-on-error/line_number_analysis_and_fix_noautorun.rb
#
# frozen_string_literal: true
#!/usr/bin/env ruby
# Line Number Analysis and Fix Documentation
#
# This file documents the line number inconsistency bug found in Tryouts v3.0
# and the fix that was applied. Keep this file for future reference.
puts "... |
github | tcopeland/olde_code_finder | https://github.com/tcopeland/olde_code_finder | Rakefile | Ruby | mit | 19 | master | 206 | require "bundler/gem_tasks"
task :default => :test
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end |
github | tcopeland/olde_code_finder | https://github.com/tcopeland/olde_code_finder | olde_code_finder.gemspec | Ruby | mit | 19 | master | 922 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'olde_code_finder/version'
Gem::Specification.new do |spec|
spec.name = "olde_code_finder"
spec.version = OldeCodeFinder::VERSION
spec.authors = ["Tom Copeland"]
spec.... |
github | tcopeland/olde_code_finder | https://github.com/tcopeland/olde_code_finder | lib/olde_code_finder/tasks.rb | Ruby | mit | 19 | master | 662 | namespace :olde_code_finder do
desc "Find code that's mostly by a particular person"
task :find_by_author, [:glob, :author, :pctg] => :environment do |task, args|
Dir[args[:glob]].select {|candidate| File.file?(candidate) }.each do |file|
OldeCodeFinder::Finder.new(file, args[:pctg]).check_by_author(args... |
github | tcopeland/olde_code_finder | https://github.com/tcopeland/olde_code_finder | lib/olde_code_finder/finder.rb | Ruby | mit | 19 | master | 1,583 | require 'date'
module OldeCodeFinder
class Finder
attr_accessor :file, :pctg
def initialize(file, pctg)
@file = file
@pctg = pctg
end
def check_by_author(author)
return if binary?
total_lines = git_blame_output.size
return if total_lines == 0
author_lines = git... |
github | bronson/geolocal | https://github.com/bronson/geolocal | geolocal.gemspec | Ruby | mit | 19 | master | 1,031 | lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'geolocal/version'
Gem::Specification.new do |spec|
spec.name = "geolocal"
spec.version = Geolocal::VERSION
spec.authors = ["Scott Bronson"]
spec.email = ["brons_geolo@rinspin... |
github | bronson/geolocal | https://github.com/bronson/geolocal | Rakefile | Ruby | mit | 19 | master | 346 | require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'geolocal/tasks'
Dir.glob('lib/tasks/*.rake').each { |r| load r}
Geolocal.configure do |config|
config.file = 'tmp/geolocal.rb' # 'lib/geolocal.rb' default would overwrite our source code
end
RSpec::Core::RakeTask.new(:spec)
task :default => ['spec... |
github | bronson/geolocal | https://github.com/bronson/geolocal | spec/spec_helper.rb | Ruby | mit | 19 | master | 305 | require 'geolocal/configuration'
require 'webmock/rspec'
WebMock.disable_net_connect!(allow_localhost: true)
RSpec.configure do |config|
config.order = 'random'
config.before :each do
Geolocal.reset_configuration
Geolocal.configure do |geoconf|
geoconf.quiet = true
end
end
end |
github | bronson/geolocal | https://github.com/bronson/geolocal | spec/geolocal/configuration_spec.rb | Ruby | mit | 19 | master | 2,592 | require 'spec_helper'
describe "configuration" do
let(:config) { Geolocal.configuration }
it "has the right defaults" do
# reset the configuration so we get the default configuration,
# not the test configuration that the spec_helper has set up.
Geolocal.reset_configuration
defaults = Geolocal.co... |
github | bronson/geolocal | https://github.com/bronson/geolocal | spec/geolocal/provider/base_spec.rb | Ruby | mit | 19 | master | 6,214 | require 'spec_helper'
require 'geolocal/provider/base'
describe Geolocal::Provider::Base do
let(:it) { described_class }
let(:provider) { it.new }
describe '#add_to_results' do
it 'adds a v4 address to the results' do
result = { 'USv4'=>[] }
expect(
provider.add_to_results(result, 'US'... |
github | bronson/geolocal | https://github.com/bronson/geolocal | spec/geolocal/provider/db_ip_spec.rb | Ruby | mit | 19 | master | 5,088 | require 'spec_helper'
require 'geolocal/provider/db_ip'
describe Geolocal::Provider::DB_IP do
let(:it) { described_class }
let(:provider) { it.new }
describe 'network operation' do
let(:country_page) {
<<-eol
<div class="container">
<h3>Free database download</h3>
<a href=... |
github | bronson/geolocal | https://github.com/bronson/geolocal | config/geolocal.rb | Ruby | mit | 19 | master | 557 | require 'geolocal/configuration'
Geolocal.configure do |config|
# This example creates a Geolocal.in_us?(addr) command:
config.countries = { us: 'US' }
# This is where the output goes. You should commit it to your project.
# config.module = 'Geolocal'
# config.file = 'lib/geolocal.rb'
# If your host is ... |
github | bronson/geolocal | https://github.com/bronson/geolocal | lib/geolocal/tasks.rb | Ruby | mit | 19 | master | 711 | require 'geolocal/configuration'
namespace :geolocal do
def configured_provider
# we use this file by default
config='config/geolocal'
# but you can specify the config file on the command line:
# `rake geolocal config=contrib/continents`
config=ENV['config'] if ENV['config']
require './'... |
github | bronson/geolocal | https://github.com/bronson/geolocal | lib/geolocal/configuration.rb | Ruby | mit | 19 | master | 1,386 | module Geolocal
class Configuration
OPTIONS = [ :provider, :module, :file, :tmpdir, :ipv4, :ipv6, :quiet, :countries ]
attr_accessor(*OPTIONS)
def initialize
# configuration defaults
@provider = 'Geolocal::Provider::DB_IP'
@module = 'Geolocal'
@file = nil # default is comput... |
github | bronson/geolocal | https://github.com/bronson/geolocal | lib/geolocal/provider/db_ip.rb | Ruby | mit | 19 | master | 3,598 | require 'geolocal/provider/base'
require 'csv'
require 'net/http'
require 'fileutils'
require 'zlib'
class Geolocal::Provider::DB_IP < Geolocal::Provider::Base
START_URL = 'https://db-ip.com/db/download/country'
# TODO: refactor progress and download code into a mixin?
def update_download_status size, length... |
github | bronson/geolocal | https://github.com/bronson/geolocal | lib/geolocal/provider/base.rb | Ruby | mit | 19 | master | 4,852 | require 'ipaddr'
require 'fileutils'
module Geolocal
module Provider
class Base
def initialize params={}
@config = params.merge(Geolocal.configuration.to_hash)
end
def config
@config
end
def download
download_files
end
def add_to_results resul... |
github | bronson/geolocal | https://github.com/bronson/geolocal | contrib/continents.rb | Ruby | mit | 19 | master | 559 | # to generate selectors for each continent:
#
# rake geolocal config=contrib/continents
#
# Now you can call Geolocal.in_africa?, in_antarcitca?, in_asia?, etc.
require 'geolocal/configuration'
require 'countries'
# creates in_x? methods for each continent: in_north_america?, in_europe?, etc.
Geolocal.configur... |
github | bronson/geolocal | https://github.com/bronson/geolocal | contrib/benchmark-continents.rb | Ruby | mit | 19 | master | 972 | # Shows timings for the generated continent selectors
# You must first run:
#
# rake geolocal config=contrib/continents
require 'benchmark'
require_relative '../tmp/geolocal.rb'
N = 1_000_000
puts
puts "running #{N} lookups on each continent:"
puts
Benchmark.bm(15, 'africa/asia') do |x|
spread = 2**32/N - 50... |
github | bronson/geolocal | https://github.com/bronson/geolocal | contrib/benchmark-array-vs-range.rb | Ruby | mit | 19 | master | 443 | require 'benchmark'
# This shows that Ranges are about twice as fast as 2-element Arrays
# Unless the range is (1.to_i..2.to_i), which is identical to Arrays
N = 10_000_000
$a = []
$r = []
def array
$a << [1,2]
end
def range
$r << (1..2)
end
Benchmark.bm(15, 'array/range') do |x|
array_report = x.report('ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.