From e2d6f0af4e49c60f5876aa087873650e1ab9b095 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 8 Aug 2012 16:28:33 +0000 Subject: 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 --- test/unit/lib/redmine/wiki_formatting/macros_test.rb | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'test/unit/lib') diff --git a/test/unit/lib/redmine/wiki_formatting/macros_test.rb b/test/unit/lib/redmine/wiki_formatting/macros_test.rb index 4bea9a57d..4583d3e9b 100644 --- a/test/unit/lib/redmine/wiki_formatting/macros_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/macros_test.rb @@ -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 '

Foo macro output

', textilizable(text) + assert_equal '

Foo: 0 () (Array)

', textilizable("{{foo}}") + assert_equal '

Foo: 0 () (Array)

', textilizable("{{foo()}}") + assert_equal '

Foo: 1 (arg1) (Array)

', textilizable("{{foo(arg1)}}") + assert_equal '

Foo: 2 (arg1,arg2) (Array)

', 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 '

Bar: (args, more args) (String)

', textilizable("{{bar(args, more args)}}") + assert_equal '

Bar: () (String)

', textilizable("{{bar}}") + assert_equal '

Bar: () (String)

', textilizable("{{bar()}}") end def test_macro_hello_world -- cgit v1.2.3