mirror of
https://github.com/redmine/redmine.git
synced 2025-11-01 19:05:51 +01:00
Adds an option to macro definition to disable arguments parsing (#11578).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10174 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -43,12 +43,26 @@ class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
|
||||
def test_macro_registration
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
macro :foo do |obj, args|
|
||||
"Foo macro output"
|
||||
"Foo: #{args.size} (#{args.join(',')}) (#{args.class.name})"
|
||||
end
|
||||
end
|
||||
|
||||
text = "{{foo}}"
|
||||
assert_equal '<p>Foo macro output</p>', textilizable(text)
|
||||
assert_equal '<p>Foo: 0 () (Array)</p>', textilizable("{{foo}}")
|
||||
assert_equal '<p>Foo: 0 () (Array)</p>', textilizable("{{foo()}}")
|
||||
assert_equal '<p>Foo: 1 (arg1) (Array)</p>', textilizable("{{foo(arg1)}}")
|
||||
assert_equal '<p>Foo: 2 (arg1,arg2) (Array)</p>', textilizable("{{foo(arg1, arg2)}}")
|
||||
end
|
||||
|
||||
def test_macro_registration_parse_args_set_to_false_should_disable_arguments_parsing
|
||||
Redmine::WikiFormatting::Macros.register do
|
||||
macro :bar, :parse_args => false do |obj, args|
|
||||
"Bar: (#{args}) (#{args.class.name})"
|
||||
end
|
||||
end
|
||||
|
||||
assert_equal '<p>Bar: (args, more args) (String)</p>', textilizable("{{bar(args, more args)}}")
|
||||
assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar}}")
|
||||
assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar()}}")
|
||||
end
|
||||
|
||||
def test_macro_hello_world
|
||||
|
||||
Reference in New Issue
Block a user