Permalink
Browse files

added snippets for Test::Unit 2.2.0 assertions

I dumped the bulk of these snippets by cooking up the following in IRB.
I then adjusted the corner cases and existing snippet conflicts by hand.

gem 'test-unit', '>= 2.2.0'
require 'test/unit'
(assertions = Test::Unit::Assertions).instance_methods.map do |name|
  abbr = name.to_s.split('_').map {|w| w[0, w == 'assert' ? 2 : 1] }.join
  File.open(abbr + '.snippet', 'w') do |snippet|
    snippet.puts [name,
      assertions.instance_method(name).parameters.
      select {|type, param| type == :req }.each_with_index.
      map {|(type,param),idx| "${#{idx.next}:#{param}}" }.join(', ')
    ].join(' ')
  end
end
  • Loading branch information...
1 parent d5a1b1d commit a9f4887259ec04628db39be2419c00805de20ad5 @sunaku committed Feb 15, 2011
View
@@ -0,0 +1 @@
+assert_alias_method ${1:object}, ${2:alias_name}, ${3:original_name}
View
@@ -0,0 +1 @@
+assert_boolean ${1:actual}
View
@@ -0,0 +1 @@
+assert_compare ${1:expected}, ${2:operator}, ${3:actual}
View
@@ -0,0 +1 @@
+assert_const_defined ${1:object}, ${2:constant_name}
View
@@ -0,0 +1 @@
+assert_empty ${1:object}
View
@@ -0,0 +1 @@
+assert_false ${1:actual}
View
@@ -0,0 +1 @@
+assert_fail_assertion { ${1:block} }
View
@@ -0,0 +1 @@
+assert_include ${1:collection}, ${2:object}
View
@@ -0,0 +1 @@
+assert_in_epsilon ${1:expected_float}, ${2:actual_float}
View
@@ -0,0 +1 @@
+assert_not_const_defined ${1:object}, ${2:constant_name}
View
@@ -0,0 +1 @@
+assert_not_empty ${1:object}
View
@@ -0,0 +1 @@
+assert_not_include ${1:collection}, ${2:object}
View
@@ -0,0 +1 @@
+assert_not_in_delta ${1:expected_float}, ${2:actual_float}
View
@@ -0,0 +1 @@
+assert_not_in_epsilon ${1:expected_float}, ${2:actual_float}
View
@@ -0,0 +1 @@
+assert_not_predicate ${1:object}, ${2:predicate}
View
@@ -0,0 +1 @@
+assert_nothing_raised { ${1:block} }
View
@@ -0,0 +1 @@
+assert_not_respond_to ${1:object}, ${2:method}
View
@@ -0,0 +1 @@
+assert_not_send ${1:send_array}
View
@@ -0,0 +1 @@
+assert_predicate ${1:object}, ${2:predicate}
View
@@ -0,0 +1 @@
+assert_path_exist ${1:path}
View
@@ -0,0 +1 @@
+assert_path_not_exist ${1:path}
View
@@ -0,0 +1 @@
+assert_raise_kind_of(${1:kinds...}) { ${2:block} }
View
@@ -0,0 +1 @@
+assert_raise_message ${1:expected_message}
View
@@ -0,0 +1 @@
+assert_send ${1:send_array}
View
@@ -0,0 +1 @@
+assert_true ${1:actual}

0 comments on commit a9f4887

Please sign in to comment.