arrow_test 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/arrow_test.rb +20 -0
- metadata +3 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b46b6c8dbd1a5aa735ffdcdd3b53255802deef8
|
4
|
+
data.tar.gz: f3c846eb3cd86cc947d28e1ae927599b7fa7071e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dfeaf8256e946431251e03e5a1f92a6f235811338fba09d104d1e0dc71a25e44a10b4ee48d7f5abb393b5476ddb680cbaf832f7a32218042997a243dd1881cb
|
7
|
+
data.tar.gz: 9d4a393b4fe64a4b0587f8ba0fe930128bfca3382957885207224355ab07a31727d25fa4f58139e550e30a63478f1275c7f173787efd8891c51134bb8b1b4d8c
|
data/lib/arrow_test.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
require 'colorize'
|
2
2
|
|
3
|
+
# Performs the logic of the arrow test.
|
4
|
+
#
|
5
|
+
# Example:
|
6
|
+
# >> helper_arrow_test(["", "1+1 #-> 3"])
|
7
|
+
# => ["ERROR:\n EXECUTING: 1 + 1\n EXPECTED: 3\n INSTEAD GOT: 2\n\n\n"]
|
8
|
+
#
|
9
|
+
# Arguments:
|
10
|
+
# lines: (String) The lines of code to be arrow tested.
|
11
|
+
# verbose: (Boolean) If true returns also correct tests.
|
3
12
|
def helper_arrow_test(lines, verbose=false)
|
4
13
|
messages = []
|
5
14
|
arrow_regex = Regexp.new('\ *\#\ *\-\ *\>\ *')
|
@@ -29,6 +38,17 @@ END
|
|
29
38
|
messages
|
30
39
|
end
|
31
40
|
|
41
|
+
# Performs Input/Output wrapping `helper_arrow_test`
|
42
|
+
# Call this in your code.
|
43
|
+
#
|
44
|
+
# Example:
|
45
|
+
# require 'arrow_testing'
|
46
|
+
# 1 + 1 # -> 3
|
47
|
+
# arrow_test
|
48
|
+
#
|
49
|
+
# Arguments:
|
50
|
+
# filename: (String) The filename to be tested. Default is $0: your current file.
|
51
|
+
# verbose: (Boolean) If true outputs also correct tests.
|
32
52
|
def arrow_test(filename=$0, verbose=false)
|
33
53
|
puts helper_arrow_test(IO.foreach(filename).to_a, verbose)
|
34
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arrow_test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caridorc Tergilti
|
@@ -13,17 +13,11 @@ dependencies: []
|
|
13
13
|
description: |2
|
14
14
|
`Vigorous testing is coincise`
|
15
15
|
|
16
|
-
This gem allows coincise testing, even shorter than
|
16
|
+
This gem allows coincise testing, even shorter than doctest.
|
17
17
|
|
18
18
|
It also adds minimal overhead to your file!
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
require 'arrow_test'
|
23
|
-
1 + 1 -> 3
|
24
|
-
arrow_test
|
25
|
-
|
26
|
-
And you are done! Running the above will show you the error.
|
20
|
+
See the documentation for examples.
|
27
21
|
email: riki100024@gmail.com
|
28
22
|
executables: []
|
29
23
|
extensions: []
|