On 12 Aug, GOTO Kentaro wrote: > Hi, > > In message "[ruby-talk:00638] Re: ANN: testsupp.rb 0.1" > on 99/08/12, Clemens Hintze <c.hintze / gmx.net> writes: [...] > Sorry for shortage of my words :-( > I intendet hierarchical test like as > > test_section("File processing") do > test_section("open and close") do > ok f = Foo.open("foo.txt") > ok f.close > end > > test_section("translation") do > Foo.open("foo.txt"){ > ok f.translate(Foo:Japanese, Foo:English) > ok f.translate(Foo:English) > } > end > end > > test_section("Inline processing") do > ... > end > > Of course, now TestSupp does not support such deep leveled nest. But, > I want categorization by block at least. I feel that start_test makes > blurred the range of each test block. Hmmm. Normally you would only use one `start_tests' and one `end_tests'. It is a little bit confuse in my example, I agree. So intention is, to write: start_tests check "open and close" ok f = Foo.open("foo.txt") ok f.close check "translation" Foo.open("foo.txt"){ ok f.translate(Foo:Japanese, Foo:English) ok f.translate(Foo:English) } end_tests That would output (hopefully ;-): 1. open and close 1.1 ... ok 1.2 ... ok 2. translation 2.1 ... ok 2.2 ... ok tests finished (totally 4 tests in 2 categories) My two main concerns against your proposal is: 1. It is pretty by using blocks, ok! But I could not easily reuse results from one block in another one. I would have to initialize variables, that should hold such results for later usage, before I enter a test block. That breaks the beauty of your concept, I think. 2. If you have many tests and/or code that prepare them, I think the `do ... end' construct will be very large. You would have to take sorrow for properly indentation to not loose overview, IMHO. Futhermore you have to look, whether your test descriptions are correct closed with corresponding `end's. But the hierarchical idea is good! Would you think, that implementing a `section' command would be enough for you? You could write then: start_tests section 1, "File processing" check "open and close" ok f = Foo.open("foo.txt") ok f.close check "translation" Foo.open("foo.txt"){ ok f.translate(Foo:Japanese, Foo:English) ok f.translate(Foo:English) } section 1, "whatever..." check "don't know" ok true end_tests The syntax would be: `section <level>, <title>'. So you could have your groupings, but no additional structuring. The output would be: 1. File processing 1.1 open and close 1.1.1 ... ok 1.1.2 ... ok 1.2 translation 1.2.1 ... ok 1.2.2 ... ok 2. whatever... 2.1 don't know 2.1.1 ... ok tests finished (totally 5 tests in 3 categories) What do you think? BTW: I could enable `section' to produce some intermediate output too; means close the previous section with a short report. > >>> 2. quiet option for all method >> >>What dou you mean with it? What would a `quiet' option do? Suppress the >>whole output? > > Yes. Usually I need only error report. Nullo problemo :-) > >>> 3. customizable output format >> [...] > Well, a proposal is > %C for @catnum > %T for @testnum > %N for @ntests > %W for @what > > Then use irb/main.rb:prompt() technic. How do you think? Hmm again :-/ A main problem remains with your template idea. The words within the template, would not be easily adaptable regarding the grammar! Please have a look to the short output: test finished (totally 1 test)! tests finished (totally 2 tests in 1 category) tests finished (totally 2 tests in 2 categories) As you can see, the words `test' and `category' are changed concerning the grammar numerus. That is very difficult to handle via template. If I, however, could call anoter method (Proc?) with that parameters, it would very easy, as the called report method would have to handle that! ;-))))) [...] > > By the way, would you try RD? CGI.rb (in contrib/) is a example for RD > documentation. And rd2html is generate html file from .rb file. I will have a look! Thanks for the pointer. :-) > > -- gotoken \cle