rcheck 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ module RCheck
2
+ VERSION = '0.1.0'
3
+ end
data/rcheck.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rcheck/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rcheck'
8
+ spec.version = RCheck::VERSION
9
+ spec.authors = ['Jostein Berre Eliassen']
10
+ spec.email = []
11
+
12
+ spec.summary = 'RCheck < RSpec'
13
+ spec.description = 'Tests that are very simple, useful and quick'
14
+ spec.homepage = 'https://github.com/jbe/rcheck'
15
+
16
+ spec.require_paths = ['lib']
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'bin'
21
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.10'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'pry'
26
+ end
@@ -0,0 +1,50 @@
1
+
2
+ RCheck 'RCheck/ClassMethods' do
3
+ suite :version do
4
+ assert RCheck.version, :include?, "Ruby #{RUBY_VERSION}"
5
+ assert RCheck.version, :include?, RCheck::VERSION
6
+ end
7
+
8
+ suite :which do
9
+ assert File, :directory?, RCheck.which
10
+ end
11
+
12
+ suite :root do
13
+ assert RCheck.root, :is_a?, RCheck::Suite
14
+ assert RCheck.root.name, :nil?
15
+ assert RCheck.root.parent, :nil?
16
+ assert RCheck.root, :==, RCheck::ROOT_SUITE
17
+ end
18
+
19
+ sample_name = 'samples/waffles'
20
+ sample = RCheck.suite(sample_name) { }
21
+
22
+ suite :suite do
23
+ assert RCheck.suite, :==, RCheck.root
24
+ assert RCheck.suite(sample_name), :==, sample
25
+ end
26
+
27
+ suite :[] do
28
+ assert RCheck[], :==, RCheck.root
29
+ assert RCheck[sample_name], :==, sample
30
+ end
31
+
32
+ suite :severity do
33
+ %i(local total subtree).each do |scope|
34
+ assert RCheck.severity(scope), :is_a?, Symbol
35
+ end
36
+ end
37
+
38
+ suite :define do
39
+ name = :sample_command
40
+ val = RCheck.define(name, '')
41
+ assert val, :is_a?, RCheck::Command
42
+ assert RCheck::Command.find(name), :==, val
43
+ end
44
+
45
+ suite :invoke! do
46
+ # rcheck was probably already invoked using this syntax, so
47
+ # there is no need, nor possible to do it again here.
48
+ assert RCheck, :respond_to?, :invoke!
49
+ end
50
+ end
@@ -0,0 +1,4 @@
1
+ RCheck 'RCheck/VERSION' do
2
+ semver_regex = /^(\d+\.\d+\.\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
3
+ assert semver_regex, :===, RCheck::VERSION
4
+ end
data/tests/sanity.rb ADDED
@@ -0,0 +1,113 @@
1
+ RCheck :sanity do
2
+
3
+ suite :axioms do
4
+ suite :foundation do
5
+ assert true
6
+ debug "truth asserts"
7
+ refute false
8
+ debug "lie refutes"
9
+ assert_safe { sleep 0.000001 }
10
+ debug "sleeping is safe"
11
+ assert_raises(RuntimeError, 'error') { raise 'error' }
12
+ debug "assert_raises catches runtime error"
13
+ end
14
+
15
+ suite :equality do
16
+ assert 1, :equal?, 1
17
+ assert 1, :eql?, 1
18
+ assert 1, :==, 1
19
+ assert 1, :===, 1
20
+ end
21
+
22
+ suite :comparison do
23
+ assert 2, :>, 1
24
+ assert 1, :>=, 1
25
+ assert 1, :<, 2
26
+ assert 1, :<=, 1
27
+ assert 1, :<=>, 2
28
+ end
29
+
30
+ suite :matching do
31
+ assert 0..10, :===, 5
32
+ assert(/hm/, :===, "hmmmmm")
33
+ end
34
+
35
+ suite :brackets do
36
+ assert [true, false], :[], 0
37
+ refute [true, false], :[], 1
38
+ assert [], :[]=, 0, true
39
+ end
40
+
41
+ suite :methods do
42
+ assert Object, :respond_to?, :new
43
+ assert Object.new, :instance_of?, Object
44
+ assert Class, :is_a?, Class
45
+ end
46
+
47
+ suite :within_delta do
48
+ assert 0.2, :>, 1.0 - 1.0
49
+ assert 0.1, :>, 100000000.0 - 100000000.0
50
+ end
51
+
52
+ suite :scope do
53
+ def helper_method() :helper_method end
54
+ helper_var = :helper_var
55
+ HELPER_CONST = :helper_const
56
+
57
+ suite :upwards do
58
+ assert helper_method, :==, :helper_method
59
+ assert helper_var, :==, :helper_var
60
+ assert HELPER_CONST, :==, :helper_const
61
+ end
62
+
63
+ suite :_unreachable do
64
+ def descendant_method() :helper_method end
65
+ descendant_var = :helper_var
66
+ end
67
+
68
+ suite :downwards do
69
+ assert_raises(NameError) { descendant_method }
70
+ assert_raises(NameError) { descendant_var }
71
+ end
72
+ end
73
+
74
+ suite :generics do
75
+ def example_law(suite, *args)
76
+ suite.assert(*args)
77
+ end
78
+
79
+ suite :child do
80
+ example_law self, true
81
+ end
82
+
83
+ def assert_custom(left, *rest)
84
+ assert(left, *rest)
85
+ val = nil
86
+ assert_safe do
87
+ val = rest.any? ? left.send(*rest) : left
88
+ end
89
+ assert val
90
+ refute !val
91
+ true
92
+ end
93
+
94
+ assert_custom true
95
+ assert_custom :symbol
96
+ assert_custom Class
97
+ assert_custom true, :==, true
98
+ assert_custom Class, :is_a?, Class
99
+ assert_custom nil, :nil?
100
+ assert_custom assert_custom(true)
101
+ end
102
+ end
103
+
104
+ # failures
105
+ # assert false
106
+ # debug "it was false!"
107
+ # refute true, :==, true
108
+ # debug "it really was"
109
+ # raise 'bah'
110
+ #
111
+ # assert_raises(RuntimeError, "yo") { raise 'bug' }
112
+ # assert_safe { raise("finger") }
113
+ end
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rcheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jostein Berre Eliassen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: Tests that are very simple, useful and quick
56
+ email: []
57
+ executables:
58
+ - rcheck
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - README.md
66
+ - Rakefile
67
+ - TODO
68
+ - bin/rcheck
69
+ - lib/rcheck.rb
70
+ - lib/rcheck/assertions.rb
71
+ - lib/rcheck/backtrace.rb
72
+ - lib/rcheck/class_methods.rb
73
+ - lib/rcheck/cli.rb
74
+ - lib/rcheck/colors.rb
75
+ - lib/rcheck/command.rb
76
+ - lib/rcheck/conf.rb
77
+ - lib/rcheck/debugging.rb
78
+ - lib/rcheck/default_commands.rb
79
+ - lib/rcheck/dsl.rb
80
+ - lib/rcheck/errors.rb
81
+ - lib/rcheck/filters.rb
82
+ - lib/rcheck/formatting.rb
83
+ - lib/rcheck/headers.rb
84
+ - lib/rcheck/option_expander.rb
85
+ - lib/rcheck/options.rb
86
+ - lib/rcheck/progress_printers.rb
87
+ - lib/rcheck/report_printers.rb
88
+ - lib/rcheck/result.rb
89
+ - lib/rcheck/suite.rb
90
+ - lib/rcheck/trollop.rb
91
+ - lib/rcheck/version.rb
92
+ - rcheck.gemspec
93
+ - tests/rcheck/class_methods.rb
94
+ - tests/rcheck/version.rb
95
+ - tests/sanity.rb
96
+ homepage: https://github.com/jbe/rcheck
97
+ licenses: []
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.4.5
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: RCheck < RSpec
119
+ test_files: []