Permalink
Browse files

Fix: specify ivar types for Crystal > 0.15

  • Loading branch information...
1 parent 8a67ad5 commit 60215ad0e1a88b1625f1d90fec4048deb1ad7847 @ysbaddaden committed Apr 12, 2016
Showing with 23 additions and 12 deletions.
  1. +5 −2 src/minitest.cr
  2. +6 −2 src/minitest/assertions.cr
  3. +2 −2 src/minitest/reporter.cr
  4. +5 −3 src/minitest/result.cr
  5. +1 −1 src/minitest/runnable.cr
  6. +2 −2 test/spec_test.cr
  7. +2 −0 test/test_test.cr
View
@@ -7,8 +7,9 @@ require "./minitest/spec"
module Minitest
class Options
- property :verbose, :threads
- getter :pattern
+ property verbose
+ property threads
+ getter pattern : String | Regex | Nil
def initialize
@verbose = false
@@ -51,6 +52,8 @@ module Minitest
end
end
+ @@reporter : AbstractReporter?
+
def self.reporter
@@reporter ||= CompositeReporter.new(options).tap do |reporter|
reporter << SummaryReporter.new(options)
@@ -1,7 +1,9 @@
require "tempfile"
class Exception
- getter :file, :line
+ getter file : String?
+ getter line : Int32?
+ getter! backtrace : Array(String)?
# NOTE: hack to report the source location that raised
def initialize(@message : String? = nil, @cause : Exception? = nil, @file = __FILE__, @line = __LINE__)
@@ -26,7 +28,7 @@ module Minitest
class UnexpectedError < Exception
include LocationFilter
- getter :exception
+ getter exception : Exception
def initialize(@exception)
super "#{exception.class.name}: #{exception.message}"
@@ -57,6 +59,8 @@ module Minitest
# TODO: assert_output / refute_output
# TODO: assert_silent / refute_silent
module Assertions
+ @@diff : Bool?
+
def self.diff?
@@diff ||= Process.new("diff").wait.success?
end
@@ -2,7 +2,7 @@ require "colorize"
module Minitest
class AbstractReporter
- getter! :options
+ getter options : Options
def initialize(@options)
end
@@ -22,7 +22,7 @@ module Minitest
end
class CompositeReporter < AbstractReporter
- getter :reporters
+ getter reporters
def initialize(@options)
@reporters = [] of AbstractReporter
@@ -1,12 +1,14 @@
module Minitest
class Result
- getter :assertions, :failures, :class_name, :name
- property :time
+ getter assertions
+ getter class_name : String
+ getter failures
+ getter name : String
+ property! time : Time::Span
def initialize(@class_name, @name)
@assertions = 0
@failures = [] of Assertion | Skip | UnexpectedError
- @time = uninitialized Time::Span # avoid nilable
end
def passed?
@@ -9,7 +9,7 @@ module Minitest
nil
end
- getter :reporter
+ getter reporter : AbstractReporter
def initialize(@reporter)
end
View
@@ -2,7 +2,7 @@ require "../src/autorun"
describe Minitest::Spec do
class Foo
- property :bar
+ property bar : String?
end
def add(a, b)
@@ -27,7 +27,7 @@ describe Minitest::Spec do
end
describe("nested describes") do
- let(:more) { "more " + data }
+ let(:more) { "more #{data}" }
it "accesses parent methods" do
assert_equal 4, add(2, 2)
View
@@ -1,3 +1,5 @@
+require "../src/autorun"
+
class Minitest::TestTest < Minitest::Test
# NOTE: we verify that tests are run in their own instance of the test suite,
# so instance variables aren't stepping on each other.

0 comments on commit 60215ad

Please sign in to comment.