-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31644cb
commit cd4800c
Showing
39 changed files
with
229 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert | ||
# key: assert | ||
# -- | ||
assert(${1:test}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_empty | ||
# key: assert_empty | ||
# -- | ||
assert_empty(${1:obj}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_equal | ||
# key: assert_equal | ||
# -- | ||
assert_equal(${1:exp}, ${2:act}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_in_delta | ||
# key: assert_in_delta | ||
# -- | ||
assert_in_delta(${1:exp}, ${2:act}, ${3:delta = 0.001}, ${4:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_in_epsilon | ||
# key: assert_in_epsilon | ||
# -- | ||
assert_in_epsilon(${1:a}, ${2:b}, ${3:epsilon = 0.001}, ${4:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_includes | ||
# key: assert_includes | ||
# -- | ||
assert_includes(${1:collection}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_instance_of | ||
# key: assert_instance_of | ||
# -- | ||
assert_instance_of(${1:cls}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_kind_of | ||
# key: assert_kind_of | ||
# -- | ||
assert_kind_of(${1:cls}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_match | ||
# key: assert_match | ||
# -- | ||
assert_match(${1:matcher}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_nil | ||
# key: assert_nil | ||
# -- | ||
assert_nil(${1:obj}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_operator | ||
# key: assert_operator | ||
# -- | ||
assert_operator(${1:o1}, ${2:op}, ${3:o2 = UNDEFINED}, ${4:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_output | ||
# key: assert_output | ||
# -- | ||
assert_output(${1:stdout = nil}, ${2:stderr = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_predicate | ||
# key: assert_predicate | ||
# -- | ||
assert_predicate(${1:o1}, ${2:op}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_raises | ||
# key: assert_raises | ||
# -- | ||
assert_raises(${1:*exp})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_respond_to | ||
# key: assert_respond_to | ||
# -- | ||
assert_respond_to(${1:obj}, ${2:meth}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_same | ||
# key: assert_same | ||
# -- | ||
assert_same(${1:exp}, ${2:act}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_send | ||
# key: assert_send | ||
# -- | ||
assert_send(${1:send_ary}, ${2:m = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_silent | ||
# key: assert_silent | ||
# -- | ||
assert_silent()$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: assert_throws | ||
# key: assert_throws | ||
# -- | ||
assert_throws(${1:sym}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: flunk | ||
# key: flunk | ||
# -- | ||
flunk(${1:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: pass | ||
# key: pass | ||
# -- | ||
pass(${1:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute | ||
# key: refute | ||
# -- | ||
refute(${1:test}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_empty | ||
# key: refute_empty | ||
# -- | ||
refute_empty(${1:obj}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_equal | ||
# key: refute_equal | ||
# -- | ||
refute_equal(${1:exp}, ${2:act}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_in_delta | ||
# key: refute_in_delta | ||
# -- | ||
refute_in_delta(${1:exp}, ${2:act}, ${3:delta = 0.001}, ${4:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_in_epsilon | ||
# key: refute_in_epsilon | ||
# -- | ||
refute_in_epsilon(${1:a}, ${2:b}, ${3:epsilon = 0.001}, ${4:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_includes | ||
# key: refute_includes | ||
# -- | ||
refute_includes(${1:collection}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_instance_of | ||
# key: refute_instance_of | ||
# -- | ||
refute_instance_of(${1:cls}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_kind_of | ||
# key: refute_kind_of | ||
# -- | ||
refute_kind_of(${1:cls}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_match | ||
# key: refute_match | ||
# -- | ||
refute_match(${1:matcher}, ${2:obj}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_nil | ||
# key: refute_nil | ||
# -- | ||
refute_nil(${1:obj}, ${2:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_operator | ||
# key: refute_operator | ||
# -- | ||
refute_operator(${1:o1}, ${2:op}, ${3:o2 = UNDEFINED}, ${4:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_predicate | ||
# key: refute_predicate | ||
# -- | ||
refute_predicate(${1:o1}, ${2:op}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_respond_to | ||
# key: refute_respond_to | ||
# -- | ||
refute_respond_to(${1:obj}, ${2:meth}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: refute_same | ||
# key: refute_same | ||
# -- | ||
refute_same(${1:exp}, ${2:act}, ${3:msg = nil})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- mode: snippet; require-final-newline: nil -*- | ||
# name: skip | ||
# key: skip | ||
# -- | ||
skip(${1:msg = nil}, ${2:bt = caller})$0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
documentation = `ri -a MiniTest::Assertions` | ||
regex = /(?:assert|refute|flunk|pass|skip)\w*\(.*\)/ | ||
line_1 = "# -*- mode: snippet; require-final-newline: nil -*-" | ||
line_2 = "# name: %s" | ||
line_3 = "# key: %s" | ||
line_4 = "# --" | ||
dir = ARGV.first | ||
exit if documentation.empty? | ||
assertions = documentation.scan(regex) | ||
Dir.mkdir(dir) unless Dir.exist?(dir) | ||
assertions.each do |assertion| | ||
# puts "Snippet for " << assertion | ||
file_name = assertion[/.+?(?=\()/] | ||
# puts "File name: " << file_name | ||
snippet = assertion.gsub(/(?<=\(|, ).+?(?=\)\s*|,\s*)/).with_index do |m, i| | ||
"${#{1+i}:#{m}}" | ||
end | ||
snippet = snippet << "$0" | ||
# puts snippet | ||
File.open(dir + ("/#{file_name}"),"w") do |file| | ||
file.puts(line_1) | ||
file.puts(sprintf(line_2, file_name)) | ||
file.puts(sprintf(line_3, file_name)) | ||
file.puts(line_4) | ||
file.puts(snippet) | ||
end | ||
end |