test/function_group_test.rb in dub-0.6.6 vs test/function_group_test.rb in dub-0.7.0
- old
+ new
@@ -5,12 +5,19 @@
context 'A FunctionGroup' do
should 'keep its members sorted by overloaded_index' do
@group = namespacecv_xml[:cv][:divide]
assert_equal [1, 2, 3, 4], @group.map {|f| f.overloaded_index}
+
+ assert_match %r{lua_type\(L, 1\)}, Dub::Lua.function_generator.chooser_body(@group)
end
+ should 'start getting type on first argument' do
+ @group = namespacecv_xml[:cv][:divide]
+ assert_match %r{lua_type\(L, 1\)}, Dub::Lua.function_generator.chooser_body(@group)
+ end
+
should 'not use top__ in chooser if all methods have same arg count' do
@method = namespacecv_xml[:cv][:Mat][:diag]
Dub::Lua.bind(@method)
assert_no_match %r{top__}, Dub::Lua.function_generator.chooser_body(@method)
end
@@ -18,7 +25,19 @@
should 'use top__ in chooser if some methods have different arg count' do
@method = namespacecv_xml[:cv][:Mat][:Mat]
Dub::Lua.bind(@method)
assert_match %r{top__}, Dub::Lua.function_generator.chooser_body(@method)
end
+
+ context 'from overloaded members' do
+ subject do
+ namespacedub_xml[:dub][:Matrix][:do_something]
+ end
+
+ should 'start getting type on second argument' do
+ # Function selector should not be fooled by the first arg == self
+ assert_no_match %r{lua_type\(L, 1\)}, Dub::Lua.function_generator.chooser_body(subject)
+ assert_match %r{lua_type\(L, 2\)}, Dub::Lua.function_generator.chooser_body(subject)
+ end
+ end
end
-end
+end
\ No newline at end of file