diff options
author | makoto kuwata <kwa@kuwata-lab.com> | 2007-05-15 16:46:51 +0000 |
---|---|---|
committer | makoto kuwata <kwa@kuwata-lab.com> | 2007-05-15 16:46:51 +0000 |
commit | 5806e6693ab79c45637ea59fe142fb5cd19cb8f2 (patch) | |
tree | 0299471cbd323a1fad399088f8aea811b6ea23a0 /test | |
parent | 3fe1e4fc73b2f9b98153c9dfd48c6f63b54769e8 (diff) | |
download | erubis-5806e6693ab79c45637ea59fe142fb5cd19cb8f2.tar.gz |
- [enhance] new command-line option '-X', '-N', '-C', and '-U' support
- [change] command 'notext' has been removed
- [change] remove test/test-notext.{rb,yaml}
- [change] command-line option '-C' has been desupported
Diffstat (limited to 'test')
-rw-r--r-- | test/test-main.rb | 12 | ||||
-rw-r--r-- | test/test-notext.rb | 27 | ||||
-rw-r--r-- | test/test-notext.yaml | 504 | ||||
-rw-r--r-- | test/test.rb | 1 |
4 files changed, 6 insertions, 538 deletions
diff --git a/test/test-main.rb b/test/test-main.rb index a918287..d3b672e 100644 --- a/test/test-main.rb +++ b/test/test-main.rb @@ -264,12 +264,12 @@ END end - def test_class1 # -C - @input = INPUT - @expected = OUTPUT.gsub(/<aaa>/, '<aaa>').gsub(/b&b/, 'b&b').gsub(/"ccc"/, '"ccc"') - @options = "-C XmlEruby" - _test() - end +# def test_class1 # -C +# @input = INPUT +# @expected = OUTPUT.gsub(/<aaa>/, '<aaa>').gsub(/b&b/, 'b&b').gsub(/"ccc"/, '"ccc"') +# @options = "-C XmlEruby" +# _test() +# end def test_notrim1 # --trim=false diff --git a/test/test-notext.rb b/test/test-notext.rb deleted file mode 100644 index 05ed2a1..0000000 --- a/test/test-notext.rb +++ /dev/null @@ -1,27 +0,0 @@ -## -## $Rev$ -## $Release$ -## $Copyright$ -## - -require File.dirname(__FILE__) + '/test' - - -class NoTextTest < Test::Unit::TestCase - - filename = __FILE__.sub(/\.\w+$/, '.yaml') - testdata_list = load_yaml_datafile(filename) - define_testmethods(testdata_list) - - def _test - File.open(@filename, 'w') { |f| f.write(@input) } - begin - result = `notext #{@options} #{@filename}` - expected = @output.gsub(/^\./, '') - assert_text_equal(expected, result) - ensure - File.unlink @filename if test(?f, @filename) - end - end - -end diff --git a/test/test-notext.yaml b/test/test-notext.yaml deleted file mode 100644 index c9e5dcf..0000000 --- a/test/test-notext.yaml +++ /dev/null @@ -1,504 +0,0 @@ ---- -- name: notext_eruby - options: '' - filename: ex-notext.rhtml - document: | - - .$$ Command 'notext' | cmd-notext - - Command 'notext' is a utility to extract only program code from eRuby/PHP/ePerl script. - It is an application of NoTextEnhancer. - - For example, see the following eRuby script. - This is some complex, so it is difficult to grasp the program code. - - .? ex-notext.rhtml - .-------------------- ex-notext.rhtml - [%= ydoc['notext_eruby']['input'].chomp %] - .-------------------- - - Command 'notext' extracts the ruby code from eRuby script. - - .? result - .==================== notext_eruby.output - $ notext ex-notext.rhtml - [%= ydoc['notext_eruby']['output'].chomp %] - .==================== - - Option '-c' ({{*c*}}ompact) deletes empty lines. - - .? result - .==================== notext_eruby_c.output - $ notext -c ex-notext.rhtml - [%= ydoc['notext_eruby_c']['output'].chomp %] - .==================== - - Option '-u' ({{*u*}}nique) replace some empty lines with a empty line. - - .? result - .==================== notext_eruby_u.output - $ notext -u ex-notext.rhtml - [%= ydoc['notext_eruby_u']['output'].chomp %] - .==================== - - Option '-n' ({{*n*}}umber) adds line number. - It is available with '-c' or '-n'. - - .? result - .==================== notext_eruby_nu.output - $ notext -nu ex-notext.rhtml - [%= ydoc['notext_eruby_nu']['output'].chomp %] - .==================== - - 'notext' is available with PHP or ePerl script. - Language is automatically detected by suffix of filename. - And you can specify language with option '-l' ({{*l*}}anguage). - - .? ex-notext.php - .-------------------- notext_php.input - [%= ydoc['notext_php']['input'].chomp %] - .-------------------- - - .? result - .==================== notext_php_nu.output - $ notext -nu ex-notext.php - [%= ydoc['notext_php_nu']['output'].chomp %] - .==================== - - .? ex-notext.eperl - .-------------------- notext_eperl.input - [%= ydoc['notext_eperl']['input'] %].chomp - .-------------------- - - .? result - .==================== notext_eperl_nu.output - $ notext -nul eperl ex-notext.eperl - [%= ydoc['notext_eperl_nu']['output'].chomp %] - .==================== - - input: &input_eruby | - <?xml version="1.0" encoding="UTF-8"?> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <body> - <h3>List</h3> - <% if @list.nil? || @list.empty? %> - <p>not found.</p> - <% else %> - <table> - <tbody> - <% @list.each_with_index do |item, i| %> - <tr bgcolor="<%= i % 2 == 0 ? '#FCC' : '#CCF' %>"> - <td><%= item %></td> - </tr> - <% end %> - </tbody> - </table> - <% end %> - </body> - </html> - output: | - ._buf = ''; - . - . - . - . - . - . if @list.nil? || @list.empty? ; - . - . else ; - . - . - . @list.each_with_index do |item, i| ; - . _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s; - . _buf << ( item ).to_s; - . - . end ; - . - . - . end ; - . - . - ._buf.to_s - -## -- name: notext_eruby_n - options: '-n' - filename: ex-notext.rhtml - input: *input_eruby - output: | - . 1: _buf = ''; - . 2: - . 3: - . 4: - . 5: - . 6: - . 7: if @list.nil? || @list.empty? ; - . 8: - . 9: else ; - . 10: - . 11: - . 12: @list.each_with_index do |item, i| ; - . 13: _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s; - . 14: _buf << ( item ).to_s; - . 15: - . 16: end ; - . 17: - . 18: - . 19: end ; - . 20: - . 21: - . 22: _buf.to_s - -## -- name: notext_eruby_c - options: '-c' - filename: ex-notext.rhtml - input: *input_eruby - output: | - ._buf = ''; - . if @list.nil? || @list.empty? ; - . else ; - . @list.each_with_index do |item, i| ; - . _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s; - . _buf << ( item ).to_s; - . end ; - . end ; - ._buf.to_s - -## -- name: notext_eruby_u - options: '-u' - filename: ex-notext.rhtml - input: &input_eruby | - <?xml version="1.0" encoding="UTF-8"?> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <body> - <h3>List</h3> - <% if @list.nil? || @list.empty? %> - <p>not found.</p> - <% else %> - <table> - <tbody> - <% @list.each_with_index do |item, i| %> - <tr bgcolor="<%= i % 2 == 0 ? '#FCC' : '#CCF' %>"> - <td><%= item %></td> - </tr> - <% end %> - </tbody> - </table> - <% end %> - </body> - </html> - output: | - ._buf = ''; - . - . if @list.nil? || @list.empty? ; - . - . else ; - . - . @list.each_with_index do |item, i| ; - . _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s; - . _buf << ( item ).to_s; - . - . end ; - . - . end ; - . - ._buf.to_s - -## -- name: notext_eruby_nc - options: '-nc' - filename: ex-notext.rhtml - input: *input_eruby - output: | - . 1: _buf = ''; - . 7: if @list.nil? || @list.empty? ; - . 9: else ; - . 12: @list.each_with_index do |item, i| ; - . 13: _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s; - . 14: _buf << ( item ).to_s; - . 16: end ; - . 19: end ; - . 22: _buf.to_s - -## -- name: notext_eruby_nu - options: '-un' - filename: ex-notext.rhtml - input: *input_eruby - output: | - . 1: _buf = ''; - . - . 7: if @list.nil? || @list.empty? ; - . - . 9: else ; - . - . 12: @list.each_with_index do |item, i| ; - . 13: _buf << ( i % 2 == 0 ? '#FCC' : '#CCF' ).to_s; - . 14: _buf << ( item ).to_s; - . - . 16: end ; - . - . 19: end ; - . - . 22: _buf.to_s -## ---- -- name: notext_php - options: '' - filename: ex-notext.php - input: &input_php | - <?xml version="1.0"?> - <html> - <body> - <h3>List</h3> - <?php if (!$list) { ?> - <p>not found.</p> - <?php } else { ?> - <table> - <tbody> - <?php $i = 0; ?> - <?php foreach ($list as $item) { ?> - <tr bgcolor="<?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?>"> - <td><?php echo $item; ?></td> - </tr> - <?php } ?> - </tbody> - </table> - <?php } ?> - </body> - </html> - output: &output_php | - . - . - . - . - . <?php if (!$list) { ?> - . - . <?php } else { ?> - . - . - . <?php $i = 0; ?> - . <?php foreach ($list as $item) { ?> - . <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . <?php echo $item; ?> - . - . <?php } ?> - . - . - . <?php } ?> - . - . - -## -- name: notext_php_n - options: '-n' - filename: ex-notext.php - input: *input_php - output: &output_php | - . 1: - . 2: - . 3: - . 4: - . 5: <?php if (!$list) { ?> - . 6: - . 7: <?php } else { ?> - . 8: - . 9: - . 10: <?php $i = 0; ?> - . 11: <?php foreach ($list as $item) { ?> - . 12: <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . 13: <?php echo $item; ?> - . 14: - . 15: <?php } ?> - . 16: - . 17: - . 18: <?php } ?> - . 19: - . 20: - -## -- name: notext_php_c - options: '-c' - filename: ex-notext.php - input: *input_php - output: &output_php | - . <?php if (!$list) { ?> - . <?php } else { ?> - . <?php $i = 0; ?> - . <?php foreach ($list as $item) { ?> - . <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . <?php echo $item; ?> - . <?php } ?> - . <?php } ?> - -## -- name: notext_php_u - options: '-u' - filename: ex-notext.php - input: *input_php - output: &output_php | - . - . <?php if (!$list) { ?> - . - . <?php } else { ?> - . - . <?php $i = 0; ?> - . <?php foreach ($list as $item) { ?> - . <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . <?php echo $item; ?> - . - . <?php } ?> - . - . <?php } ?> - . - -## -- name: notext_php_nc - options: '-nc' - filename: ex-notext.php - input: *input_php - output: &output_php | - . 5: <?php if (!$list) { ?> - . 7: <?php } else { ?> - . 10: <?php $i = 0; ?> - . 11: <?php foreach ($list as $item) { ?> - . 12: <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . 13: <?php echo $item; ?> - . 15: <?php } ?> - . 18: <?php } ?> - -## -- name: notext_php_nu - options: '-nu' - filename: ex-notext.php - input: *input_php - output: &output_php | - . - . 5: <?php if (!$list) { ?> - . - . 7: <?php } else { ?> - . - . 10: <?php $i = 0; ?> - . 11: <?php foreach ($list as $item) { ?> - . 12: <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . 13: <?php echo $item; ?> - . - . 15: <?php } ?> - . - . 18: <?php } ?> - . - -## -- name: notext_php_shortnotation - options: '' - filename: ex-short-notation.php - input: | - . <table> - . <? $i = 0; ?> - . <? foreach ($list as $item) { ?> - . <tr bgcolor="<?= ++$i % 2 == 1 ? '#FCC' : '#CCF' ?>"> - . <td><?= $item ?></td> - . </tr> - . <? } ?> - . </table> - output: | - . - . <?php $i = 0; ?> - . <?php foreach ($list as $item) { ?> - . <?php echo ++$i % 2 == 1 ? '#FCC' : '#CCF'; ?> - . <?php echo $item; ?> - . - . <?php } ?> - . - -## ---- -- name: notext_eperl - options: '' - filename: ex-notext.eperl - input: &input_eperl | - <?xml version="1.0"?> - <html> - <body> - <h3>List</h3> - <? if (!@list) { !> - <p>not found.</p> - <? } else { !> - <table> - <tbody> - <? $i = 0; !> - <? foreach ($item in @list) { !> - <tr bgcolor="<?= ++$i % 2 == 1 ? '#FCC' : '#CCF' !>"> - <td><?= $item !></td> - </tr> - <? } !> - </tbody> - </table> - <? } !> - </body> - </html> - output: | - .use HTML::Entities; - . - . - . - . if (!@list) { - . - . } else { - . - . - . $i = 0; - . foreach ($item in @list) { - . print(++$i % 2 == 1 ? '#FCC' : '#CCF'); - . print($item); - . - . } - . - . - . } - . - . - -## -- name: notext_eperl_nc - options: '-nc' - filename: ex-notext.eperl - input: *input_eperl - output: | - . 1: use HTML::Entities; - . 5: if (!@list) { - . 7: } else { - . 10: $i = 0; - . 11: foreach ($item in @list) { - . 12: print(++$i % 2 == 1 ? '#FCC' : '#CCF'); - . 13: print($item); - . 15: } - . 18: } - -## -- name: notext_eperl_nu - options: '-nu' - filename: ex-notext.eperl - input: *input_eperl - output: | - . 1: use HTML::Entities; - . - . 5: if (!@list) { - . - . 7: } else { - . - . 10: $i = 0; - . 11: foreach ($item in @list) { - . 12: print(++$i % 2 == 1 ? '#FCC' : '#CCF'); - . 13: print($item); - . - . 15: } - . - . 18: } - . diff --git a/test/test.rb b/test/test.rb index 3e41995..18590cb 100644 --- a/test/test.rb +++ b/test/test.rb @@ -26,6 +26,5 @@ if $0 == __FILE__ require "#{TESTDIR}/test-engines.rb" require "#{TESTDIR}/test-enhancers.rb" require "#{TESTDIR}/test-main.rb" - require "#{TESTDIR}/test-notext.rb" require "#{TESTDIR}/test-users-guide.rb" end |