sus 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sus/it.rb +0 -1
- data/lib/sus/version.rb +1 -1
- metadata +2 -20
- data/lib/sus/command/list.rb +0 -36
- data/lib/sus/command/run.rb +0 -104
- data/lib/sus/command/sequential.rb +0 -35
- data/lib/sus/command/top.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1df466d84d494d20a673f838f968b1d89456928dfea7a9ca7b72f50d3675345
|
4
|
+
data.tar.gz: 0277ccbe0791b8c0e78e0301a9bd73704eb46177754710d516baf6e77a7fa125
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16b55cb766a2ab965d0e5cf136d448b3bfb2978d72761ef39e78379f40cd947769c26208e831ed8ea6432e6d902e01a9e1b69b391074758f7341b921d2b66e12
|
7
|
+
data.tar.gz: c1e44c881562220f893067320d07f0a71f2906b8867bc6162a5618b534bbcc571cf693ead8152e854595141f6d7d93d4cb242c10b97de643f92be8bdc153b43f
|
data/lib/sus/it.rb
CHANGED
data/lib/sus/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -9,21 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2021-12-05 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: samovar
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
12
|
+
dependencies: []
|
27
13
|
description:
|
28
14
|
email:
|
29
15
|
executables:
|
@@ -37,10 +23,6 @@ files:
|
|
37
23
|
- lib/sus/assertions.rb
|
38
24
|
- lib/sus/base.rb
|
39
25
|
- lib/sus/be.rb
|
40
|
-
- lib/sus/command/list.rb
|
41
|
-
- lib/sus/command/run.rb
|
42
|
-
- lib/sus/command/sequential.rb
|
43
|
-
- lib/sus/command/top.rb
|
44
26
|
- lib/sus/context.rb
|
45
27
|
- lib/sus/describe.rb
|
46
28
|
- lib/sus/expect.rb
|
data/lib/sus/command/list.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'etc'
|
2
|
-
require 'samovar'
|
3
|
-
|
4
|
-
module Sus
|
5
|
-
module Command
|
6
|
-
class List < Samovar::Command
|
7
|
-
self.description = "List all available tests."
|
8
|
-
|
9
|
-
many :paths
|
10
|
-
|
11
|
-
def prepare(registry)
|
12
|
-
if paths&.any?
|
13
|
-
paths.each do |path|
|
14
|
-
registry.load(path)
|
15
|
-
end
|
16
|
-
else
|
17
|
-
Dir.glob("test/**/*.rb").each do |path|
|
18
|
-
registry.load(path)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def call
|
24
|
-
registry = Sus::Registry.new
|
25
|
-
output = Sus::Output.default
|
26
|
-
|
27
|
-
prepare(registry)
|
28
|
-
|
29
|
-
registry.each do |child|
|
30
|
-
child.print(output)
|
31
|
-
output.puts
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
data/lib/sus/command/run.rb
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
require 'etc'
|
2
|
-
require 'samovar'
|
3
|
-
|
4
|
-
module Sus
|
5
|
-
module Command
|
6
|
-
class Run < Samovar::Command
|
7
|
-
self.description = "Run one or more tests."
|
8
|
-
|
9
|
-
options do
|
10
|
-
option '-c/--count <n>', "The number of threads to use for running tests.", type: Integer, default: Etc.nprocessors
|
11
|
-
option '-r/--require <path>', ""
|
12
|
-
end
|
13
|
-
|
14
|
-
many :paths
|
15
|
-
|
16
|
-
def prepare(registry)
|
17
|
-
if paths&.any?
|
18
|
-
paths.each do |path|
|
19
|
-
registry.load(path)
|
20
|
-
end
|
21
|
-
else
|
22
|
-
Dir.glob("test/**/*.rb").each do |path|
|
23
|
-
registry.load(path)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
Result = Struct.new(:job, :assertions)
|
29
|
-
|
30
|
-
def call
|
31
|
-
registry = Sus::Registry.new
|
32
|
-
jobs = Thread::Queue.new
|
33
|
-
results = Thread::Queue.new
|
34
|
-
|
35
|
-
output = Sus::Output.default
|
36
|
-
guard = Thread::Mutex.new
|
37
|
-
progress = Sus::Progress.new(output)
|
38
|
-
count = @options[:count]
|
39
|
-
|
40
|
-
loader = Thread.new do
|
41
|
-
prepare(registry)
|
42
|
-
|
43
|
-
registry.each do |child|
|
44
|
-
guard.synchronize{progress.expand}
|
45
|
-
jobs << child
|
46
|
-
end
|
47
|
-
|
48
|
-
jobs.close
|
49
|
-
end
|
50
|
-
|
51
|
-
aggregation = Thread.new do
|
52
|
-
assertions = Sus::Assertions.new(output: output.buffered)
|
53
|
-
first = true
|
54
|
-
|
55
|
-
while result = results.pop
|
56
|
-
guard.synchronize{progress.increment}
|
57
|
-
|
58
|
-
if result.assertions.failed?
|
59
|
-
if first
|
60
|
-
first = false
|
61
|
-
else
|
62
|
-
assertions.output.puts
|
63
|
-
end
|
64
|
-
|
65
|
-
result.assertions.output.append(assertions.output)
|
66
|
-
end
|
67
|
-
|
68
|
-
assertions.add(result.assertions)
|
69
|
-
guard.synchronize{progress.report(count, assertions, :busy)}
|
70
|
-
end
|
71
|
-
|
72
|
-
guard.synchronize{progress.clear}
|
73
|
-
|
74
|
-
assertions.output.puts unless first
|
75
|
-
assertions.output.append(output)
|
76
|
-
|
77
|
-
assertions.print(output)
|
78
|
-
output.puts
|
79
|
-
end
|
80
|
-
|
81
|
-
workers = count.times.map do |index|
|
82
|
-
Thread.new do
|
83
|
-
while job = jobs.pop
|
84
|
-
guard.synchronize{progress.report(index, job, :busy)}
|
85
|
-
|
86
|
-
assertions = Sus::Assertions.new(output: output.buffered)
|
87
|
-
job.call(assertions)
|
88
|
-
results << Result.new(job, assertions)
|
89
|
-
|
90
|
-
guard.synchronize{progress.report(index, "idle", :free)}
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
loader.join
|
96
|
-
|
97
|
-
workers.each(&:join)
|
98
|
-
results.close
|
99
|
-
|
100
|
-
aggregation.join
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'etc'
|
2
|
-
require 'samovar'
|
3
|
-
|
4
|
-
module Sus
|
5
|
-
module Command
|
6
|
-
class Sequential < Samovar::Command
|
7
|
-
self.description = "Run one or more tests."
|
8
|
-
|
9
|
-
many :paths
|
10
|
-
|
11
|
-
def prepare(registry)
|
12
|
-
if paths&.any?
|
13
|
-
paths.each do |path|
|
14
|
-
registry.load(path)
|
15
|
-
end
|
16
|
-
else
|
17
|
-
Dir.glob("test/**/*.rb").each do |path|
|
18
|
-
registry.load(path)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Result = Struct.new(:job, :assertions)
|
24
|
-
|
25
|
-
def call
|
26
|
-
registry = Sus::Registry.new
|
27
|
-
output = Sus::Output.default
|
28
|
-
|
29
|
-
prepare(registry)
|
30
|
-
|
31
|
-
registry.call
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
data/lib/sus/command/top.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'samovar'
|
2
|
-
require_relative 'run'
|
3
|
-
require_relative 'sequential'
|
4
|
-
require_relative 'list'
|
5
|
-
|
6
|
-
module Sus
|
7
|
-
module Command
|
8
|
-
class Top < Samovar::Command
|
9
|
-
self.description = "Test your code."
|
10
|
-
|
11
|
-
nested :command, {
|
12
|
-
'run' => Run,
|
13
|
-
'sequential' => Sequential,
|
14
|
-
'list' => List,
|
15
|
-
}, default: 'run'
|
16
|
-
|
17
|
-
def call
|
18
|
-
if command = self.command
|
19
|
-
command.call
|
20
|
-
else
|
21
|
-
self.print_usage
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|