sus 0.11.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/sus/assertions.rb +8 -0
- data/lib/sus/base.rb +2 -2
- data/lib/sus/clock.rb +21 -10
- data/lib/sus/expect.rb +3 -3
- data/lib/sus/output.rb +1 -0
- data/lib/sus/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 215e58e8a6634f65126546c43a66bd8479bf844fac053807d7d4094634fdc0ee
|
4
|
+
data.tar.gz: b85ff11efcd467c8f101a4051d83012f74bc134a17f2eafc37b0248e2da95260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7981aa6fe18a62ae576537bd46375809e1d52d0a5362e729069e7f30ac56d6507b135490bd3bd3bb0d22143bbdd7d8a3c95d89838d4adb6071d4c8f723656eb2
|
7
|
+
data.tar.gz: 1940a4dc0cd0c955a657303f4c218a9ec771d361e000d99e9b7c0b01f9fc09ab13bb36329e81491ea92b6b590e135a3316b054213785f7ff6a59c52249fc7e9f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/sus/assertions.rb
CHANGED
@@ -130,6 +130,10 @@ module Sus
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
133
|
+
def inform(message)
|
134
|
+
@output.puts(:indent, :inform, inform_prefix, message)
|
135
|
+
end
|
136
|
+
|
133
137
|
# Add deferred assertions.
|
134
138
|
def defer(&block)
|
135
139
|
@deferred << block
|
@@ -266,5 +270,9 @@ module Sus
|
|
266
270
|
def fail_prefix
|
267
271
|
"✗ "
|
268
272
|
end
|
273
|
+
|
274
|
+
def inform_prefix
|
275
|
+
"ℹ "
|
276
|
+
end
|
269
277
|
end
|
270
278
|
end
|
data/lib/sus/base.rb
CHANGED
data/lib/sus/clock.rb
CHANGED
@@ -15,23 +15,33 @@ module Sus
|
|
15
15
|
@duration = duration
|
16
16
|
end
|
17
17
|
|
18
|
-
|
18
|
+
def duration
|
19
|
+
if @start_time
|
20
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
21
|
+
@duration += now - @start_time
|
22
|
+
@start_time = now
|
23
|
+
end
|
24
|
+
|
25
|
+
return @duration
|
26
|
+
end
|
19
27
|
|
20
28
|
def <=>(other)
|
21
|
-
|
29
|
+
duration <=> other.to_f
|
22
30
|
end
|
23
31
|
|
24
32
|
def to_f
|
25
|
-
|
33
|
+
duration
|
26
34
|
end
|
27
35
|
|
28
36
|
def to_s
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
"#{(
|
37
|
+
duration = self.duration
|
38
|
+
|
39
|
+
if duration < 0.001
|
40
|
+
"#{(duration * 1_000_000).round(1)}µs"
|
41
|
+
elsif duration < 1.0
|
42
|
+
"#{(duration * 1_000).round(1)}ms"
|
33
43
|
else
|
34
|
-
"#{
|
44
|
+
"#{duration.round(1)}s"
|
35
45
|
end
|
36
46
|
end
|
37
47
|
|
@@ -41,11 +51,12 @@ module Sus
|
|
41
51
|
|
42
52
|
def stop!
|
43
53
|
if @start_time
|
44
|
-
|
54
|
+
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
55
|
+
@duration += now - @start_time
|
45
56
|
@start_time = nil
|
46
57
|
end
|
47
58
|
|
48
|
-
return
|
59
|
+
return duration
|
49
60
|
end
|
50
61
|
end
|
51
62
|
end
|
data/lib/sus/expect.rb
CHANGED
@@ -44,11 +44,11 @@ module Sus
|
|
44
44
|
end
|
45
45
|
|
46
46
|
class Base
|
47
|
-
def expect(subject = nil,
|
47
|
+
def expect(subject = nil, &block)
|
48
48
|
if block_given?
|
49
|
-
Expect.new(@__assertions__, block
|
49
|
+
Expect.new(@__assertions__, block)
|
50
50
|
else
|
51
|
-
Expect.new(@__assertions__, subject
|
51
|
+
Expect.new(@__assertions__, subject)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
data/lib/sus/output.rb
CHANGED
data/lib/sus/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
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.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
|
-
rubygems_version: 3.
|
112
|
+
rubygems_version: 3.1.6
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: A fast and scalable test runner.
|
metadata.gz.sig
CHANGED
Binary file
|