From 09b03e9b1c45343cf5399c40a2210f5d741f2ae2 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Tue, 9 Apr 2013 10:40:27 -0400 Subject: [PATCH] Change EdgeCase to Neo --- src/about_array_assignment.rb | 4 ++-- src/about_arrays.rb | 4 ++-- src/about_asserts.rb | 4 ++-- src/about_blocks.rb | 4 ++-- src/about_class_methods.rb | 4 ++-- src/about_classes.rb | 4 ++-- src/about_constants.rb | 4 ++-- src/about_control_statements.rb | 4 ++-- src/about_dice_project.rb | 4 ++-- src/about_exceptions.rb | 4 ++-- src/about_hashes.rb | 4 ++-- src/about_inheritance.rb | 4 ++-- src/about_iteration.rb | 4 ++-- src/about_java_interop.rb | 4 ++-- src/about_keyword_arguments.rb | 4 ++-- src/about_message_passing.rb | 4 ++-- src/about_methods.rb | 4 ++-- src/about_modules.rb | 4 ++-- src/about_nil.rb | 4 ++-- src/about_objects.rb | 4 ++-- src/about_open_classes.rb | 4 ++-- src/about_proxy_object_project.rb | 6 +++--- src/about_regular_expressions.rb | 4 ++-- src/about_sandwich_code.rb | 4 ++-- src/about_scope.rb | 4 ++-- src/about_scoring_project.rb | 4 ++-- src/about_strings.rb | 4 ++-- src/about_symbols.rb | 4 ++-- src/about_to_str.rb | 4 ++-- src/about_triangle_project.rb | 4 ++-- src/about_triangle_project_2.rb | 4 ++-- src/about_true_and_false.rb | 4 ++-- src/{edgecase.rb => neo.rb} | 29 ++++++++++++++--------------- 33 files changed, 79 insertions(+), 80 deletions(-) rename src/{edgecase.rb => neo.rb} (94%) diff --git a/src/about_array_assignment.rb b/src/about_array_assignment.rb index 35af856..a08f512 100644 --- a/src/about_array_assignment.rb +++ b/src/about_array_assignment.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutArrayAssignment < EdgeCase::Koan +class AboutArrayAssignment < Neo::Koan def test_non_parallel_assignment names = ["John", "Smith"] assert_equal __(["John", "Smith"]), names diff --git a/src/about_arrays.rb b/src/about_arrays.rb index 35c951d..a415538 100644 --- a/src/about_arrays.rb +++ b/src/about_arrays.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutArrays < EdgeCase::Koan +class AboutArrays < Neo::Koan def test_creating_arrays empty_array = Array.new assert_equal __(Array), empty_array.class diff --git a/src/about_asserts.rb b/src/about_asserts.rb index 5ac6b55..88c3100 100644 --- a/src/about_asserts.rb +++ b/src/about_asserts.rb @@ -1,9 +1,9 @@ #!/usr/bin/env ruby # -*- ruby -*- -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutAsserts < EdgeCase::Koan +class AboutAsserts < Neo::Koan # We shall contemplate truth by testing reality, via asserts. def test_assert_truth diff --git a/src/about_blocks.rb b/src/about_blocks.rb index 483fc26..af6f207 100644 --- a/src/about_blocks.rb +++ b/src/about_blocks.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutBlocks < EdgeCase::Koan +class AboutBlocks < Neo::Koan def method_with_block result = yield result diff --git a/src/about_class_methods.rb b/src/about_class_methods.rb index 2cadbaa..a352d2d 100644 --- a/src/about_class_methods.rb +++ b/src/about_class_methods.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutClassMethods < EdgeCase::Koan +class AboutClassMethods < Neo::Koan class Dog end diff --git a/src/about_classes.rb b/src/about_classes.rb index a8336bf..e1de7d7 100644 --- a/src/about_classes.rb +++ b/src/about_classes.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutClasses < EdgeCase::Koan +class AboutClasses < Neo::Koan class Dog end diff --git a/src/about_constants.rb b/src/about_constants.rb index dd0bc39..49d2b5a 100644 --- a/src/about_constants.rb +++ b/src/about_constants.rb @@ -1,8 +1,8 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') C = "top level" -class AboutConstants < EdgeCase::Koan +class AboutConstants < Neo::Koan C = "nested" diff --git a/src/about_control_statements.rb b/src/about_control_statements.rb index 1e799e6..99953ec 100644 --- a/src/about_control_statements.rb +++ b/src/about_control_statements.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutControlStatements < EdgeCase::Koan +class AboutControlStatements < Neo::Koan def test_if_then_else_statements if true diff --git a/src/about_dice_project.rb b/src/about_dice_project.rb index 65c21df..98717ba 100644 --- a/src/about_dice_project.rb +++ b/src/about_dice_project.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') # Implement a DiceSet Class here: # @@ -15,7 +15,7 @@ class DiceSet end #++ -class AboutDiceProject < EdgeCase::Koan +class AboutDiceProject < Neo::Koan def test_can_create_a_dice_set dice = DiceSet.new assert_not_nil dice diff --git a/src/about_exceptions.rb b/src/about_exceptions.rb index 652f932..b4ad63d 100644 --- a/src/about_exceptions.rb +++ b/src/about_exceptions.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutExceptions < EdgeCase::Koan +class AboutExceptions < Neo::Koan class MySpecialError < RuntimeError end diff --git a/src/about_hashes.rb b/src/about_hashes.rb index b9a4f24..ef58621 100644 --- a/src/about_hashes.rb +++ b/src/about_hashes.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutHashes < EdgeCase::Koan +class AboutHashes < Neo::Koan def test_creating_hashes empty_hash = Hash.new assert_equal __(Hash), empty_hash.class diff --git a/src/about_inheritance.rb b/src/about_inheritance.rb index 73030c6..3a119c0 100644 --- a/src/about_inheritance.rb +++ b/src/about_inheritance.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutInheritance < EdgeCase::Koan +class AboutInheritance < Neo::Koan class Dog attr_reader :name diff --git a/src/about_iteration.rb b/src/about_iteration.rb index 331c18c..8e16bf6 100644 --- a/src/about_iteration.rb +++ b/src/about_iteration.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutIteration < EdgeCase::Koan +class AboutIteration < Neo::Koan # -- An Aside ------------------------------------------------------ # Ruby 1.8 stores names as strings. Ruby 1.9 stores names as diff --git a/src/about_java_interop.rb b/src/about_java_interop.rb index c2d2142..83c2a21 100644 --- a/src/about_java_interop.rb +++ b/src/about_java_interop.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') include Java @@ -11,7 +11,7 @@ include Java # * Calling custom java class # * Calling Ruby from java??? -class AboutJavaInterop < EdgeCase::Koan +class AboutJavaInterop < Neo::Koan def test_using_a_java_library_class java_array = java.util.ArrayList.new assert_equal __(Java::JavaUtil::ArrayList), java_array.class diff --git a/src/about_keyword_arguments.rb b/src/about_keyword_arguments.rb index 7b37e1b..1596034 100644 --- a/src/about_keyword_arguments.rb +++ b/src/about_keyword_arguments.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutMethods < EdgeCase::Koan +class AboutMethods < Neo::Koan def method_with_keyword_arguments(one: 1, two: 'two') [one, two] diff --git a/src/about_message_passing.rb b/src/about_message_passing.rb index 11a0a79..4301a95 100644 --- a/src/about_message_passing.rb +++ b/src/about_message_passing.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutMessagePassing < EdgeCase::Koan +class AboutMessagePassing < Neo::Koan class MessageCatcher def caught? diff --git a/src/about_methods.rb b/src/about_methods.rb index dee1387..2a1c3fa 100644 --- a/src/about_methods.rb +++ b/src/about_methods.rb @@ -1,10 +1,10 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') def my_global_method(a,b) a + b end -class AboutMethods < EdgeCase::Koan +class AboutMethods < Neo::Koan def test_calling_global_methods assert_equal __(5), my_global_method(2,3) diff --git a/src/about_modules.rb b/src/about_modules.rb index 334b175..a96c662 100644 --- a/src/about_modules.rb +++ b/src/about_modules.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutModules < EdgeCase::Koan +class AboutModules < Neo::Koan module Nameable def set_name(new_name) @name = new_name diff --git a/src/about_nil.rb b/src/about_nil.rb index 9df4f9b..0c084d7 100644 --- a/src/about_nil.rb +++ b/src/about_nil.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutNil < EdgeCase::Koan +class AboutNil < Neo::Koan def test_nil_is_an_object assert_equal __(true), nil.is_a?(Object), "Unlike NULL in other languages" end diff --git a/src/about_objects.rb b/src/about_objects.rb index 3d068a9..0d75258 100644 --- a/src/about_objects.rb +++ b/src/about_objects.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutObjects < EdgeCase::Koan +class AboutObjects < Neo::Koan def test_everything_is_an_object assert_equal __(true), 1.is_a?(Object) assert_equal __(true), 1.5.is_a?(Object) diff --git a/src/about_open_classes.rb b/src/about_open_classes.rb index 80df888..0372f50 100644 --- a/src/about_open_classes.rb +++ b/src/about_open_classes.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutOpenClasses < EdgeCase::Koan +class AboutOpenClasses < Neo::Koan class Dog def bark "WOOF" diff --git a/src/about_proxy_object_project.rb b/src/about_proxy_object_project.rb index 7e8be03..3f969f6 100644 --- a/src/about_proxy_object_project.rb +++ b/src/about_proxy_object_project.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') # Project: Create a Proxy Class # @@ -42,7 +42,7 @@ end # The proxy object should pass the following Koan: # -class AboutProxyObjectProject < EdgeCase::Koan +class AboutProxyObjectProject < Neo::Koan def test_proxy_method_returns_wrapped_object # NOTE: The Television class is defined below tv = Proxy.new(Television.new) @@ -135,7 +135,7 @@ class Television end # Tests for the Television class. All of theses tests should pass. -class TelevisionTest < EdgeCase::Koan +class TelevisionTest < Neo::Koan def test_it_turns_on tv = Television.new diff --git a/src/about_regular_expressions.rb b/src/about_regular_expressions.rb index 03e8f9a..76bd566 100644 --- a/src/about_regular_expressions.rb +++ b/src/about_regular_expressions.rb @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutRegularExpressions < EdgeCase::Koan +class AboutRegularExpressions < Neo::Koan def test_a_pattern_is_a_regular_expression assert_equal __(Regexp), /pattern/.class end diff --git a/src/about_sandwich_code.rb b/src/about_sandwich_code.rb index c12525d..1314ec8 100644 --- a/src/about_sandwich_code.rb +++ b/src/about_sandwich_code.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutSandwichCode < EdgeCase::Koan +class AboutSandwichCode < Neo::Koan def count_lines(file_name) file = open(file_name) diff --git a/src/about_scope.rb b/src/about_scope.rb index afd8767..4760a9a 100644 --- a/src/about_scope.rb +++ b/src/about_scope.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutScope < EdgeCase::Koan +class AboutScope < Neo::Koan module Jims class Dog def identify diff --git a/src/about_scoring_project.rb b/src/about_scoring_project.rb index 60b4682..8315520 100644 --- a/src/about_scoring_project.rb +++ b/src/about_scoring_project.rb @@ -1,4 +1,4 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') # Greed is a dice game where you roll up to five dice to accumulate # points. The following "score" function will be used to calculate the @@ -54,7 +54,7 @@ def score(dice) #++ end -class AboutScoringProject < EdgeCase::Koan +class AboutScoringProject < Neo::Koan def test_score_of_an_empty_list_is_zero assert_equal 0, score([]) end diff --git a/src/about_strings.rb b/src/about_strings.rb index dd13fec..8a96a52 100644 --- a/src/about_strings.rb +++ b/src/about_strings.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutStrings < EdgeCase::Koan +class AboutStrings < Neo::Koan def test_double_quoted_strings_are_strings string = "Hello, World" assert_equal __(true), string.is_a?(String) diff --git a/src/about_symbols.rb b/src/about_symbols.rb index 720ca8c..c2c9321 100644 --- a/src/about_symbols.rb +++ b/src/about_symbols.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutSymbols < EdgeCase::Koan +class AboutSymbols < Neo::Koan def test_symbols_are_symbols symbol = :ruby assert_equal __(true), symbol.is_a?(Symbol) diff --git a/src/about_to_str.rb b/src/about_to_str.rb index 68c40b2..669a4df 100644 --- a/src/about_to_str.rb +++ b/src/about_to_str.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutToStr < EdgeCase::Koan +class AboutToStr < Neo::Koan class CanNotBeTreatedAsString def to_s diff --git a/src/about_triangle_project.rb b/src/about_triangle_project.rb index da23bbd..ec2447c 100644 --- a/src/about_triangle_project.rb +++ b/src/about_triangle_project.rb @@ -1,9 +1,9 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') # You need to write the triangle method in the file 'triangle.rb' require 'triangle.rb' -class AboutTriangleProject < EdgeCase::Koan +class AboutTriangleProject < Neo::Koan def test_equilateral_triangles_have_equal_sides assert_equal :equilateral, triangle(2, 2, 2) assert_equal :equilateral, triangle(10, 10, 10) diff --git a/src/about_triangle_project_2.rb b/src/about_triangle_project_2.rb index 347c3b1..55dd742 100644 --- a/src/about_triangle_project_2.rb +++ b/src/about_triangle_project_2.rb @@ -1,9 +1,9 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') # You need to write the triangle method in the file 'triangle.rb' require 'triangle.rb' -class AboutTriangleProject2 < EdgeCase::Koan +class AboutTriangleProject2 < Neo::Koan # The first assignment did not talk about how to handle errors. # Let's handle that part now. def test_illegal_triangles_throw_exceptions diff --git a/src/about_true_and_false.rb b/src/about_true_and_false.rb index e9910f6..470489e 100644 --- a/src/about_true_and_false.rb +++ b/src/about_true_and_false.rb @@ -1,6 +1,6 @@ -require File.expand_path(File.dirname(__FILE__) + '/edgecase') +require File.expand_path(File.dirname(__FILE__) + '/neo') -class AboutTrueAndFalse < EdgeCase::Koan +class AboutTrueAndFalse < Neo::Koan def truth_value(condition) if condition :true_stuff diff --git a/src/edgecase.rb b/src/neo.rb similarity index 94% rename from src/edgecase.rb rename to src/neo.rb index 713f55d..06c60ca 100644 --- a/src/edgecase.rb +++ b/src/neo.rb @@ -83,8 +83,7 @@ class String end end -# TODO: Change EdgeCase to Neo -module EdgeCase +module Neo class << self def simple_output ENV['SIMPLE_KOAN_OUTPUT'] == 'true' @@ -196,7 +195,7 @@ module EdgeCase @failure = step.failure add_progress(@pass_count) @observations << Color.red("#{step.koan_file}##{step.name} has damaged your karma.") - throw :edgecase_exit + throw :neo_exit end end @@ -222,7 +221,7 @@ module EdgeCase def show_progress bar_width = 50 - total_tests = EdgeCase::Koan.total_tests + total_tests = Neo::Koan.total_tests scale = bar_width.to_f/total_tests print Color.green("your path thus far [") happy_steps = (pass_count*scale).to_i @@ -238,7 +237,7 @@ module EdgeCase end def end_screen - if EdgeCase.simple_output + if Neo.simple_output boring_end_screen else artistic_end_screen @@ -275,7 +274,7 @@ module EdgeCase ,:::::::::::::, brought to you by ,,::::::::::::, :::::::::::::: ,:::::::::::: ::::::::::::::, ,::::::::::::: - ::::::::::::, EdgeCase Software Artisans , :::::::::::: + ::::::::::::, Neo Software Artisans , :::::::::::: :,::::::::: :::: ::::::::::::: ,::::::::::: ,: ,,:::::::::::::, :::::::::::: ,::::::::::::::, @@ -337,7 +336,7 @@ ENDTEXT def find_interesting_lines(backtrace) backtrace.reject { |line| - line =~ /test\/unit\/|edgecase\.rb|minitest/ + line =~ /test\/unit\/|neo\.rb|minitest/ } end @@ -397,19 +396,19 @@ ENDTEXT setup begin send(name) - rescue StandardError, EdgeCase::Sensei::AssertionError => ex + rescue StandardError, Neo::Sensei::AssertionError => ex failed(ex) ensure begin teardown - rescue StandardError, EdgeCase::Sensei::AssertionError => ex + rescue StandardError, Neo::Sensei::AssertionError => ex failed(ex) if passed? end end self end - # Class methods for the EdgeCase test suite. + # Class methods for the Neo test suite. class << self def inherited(subclass) subclasses << subclass @@ -466,7 +465,7 @@ ENDTEXT class ThePath def walk - sensei = EdgeCase::Sensei.new + sensei = Neo::Sensei.new each_step do |step| sensei.observe(step.meditate) end @@ -474,9 +473,9 @@ ENDTEXT end def each_step - catch(:edgecase_exit) { + catch(:neo_exit) { step_count = 0 - EdgeCase::Koan.subclasses.each_with_index do |koan,koan_index| + Neo::Koan.subclasses.each_with_index do |koan,koan_index| koan.testmethods.each do |method_name| step = koan.new(method_name, koan.to_s, koan_index+1, step_count+=1) yield step @@ -488,6 +487,6 @@ ENDTEXT end END { - EdgeCase::Koan.command_line(ARGV) - EdgeCase::ThePath.new.walk + Neo::Koan.command_line(ARGV) + Neo::ThePath.new.walk }