From noreply at rubyforge.org Sun Nov 1 01:24:08 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 1 Nov 2009 01:24:08 -0400 (EDT) Subject: [test-unit-tracker] [ test-unit-Bugs-27374 ] omit_if unexpected behavior Message-ID: <20091101052408.661CC1588063@rubyforge.org> Bugs item #27374, was opened at 2009-10-31 00:58 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21856&aid=27374&group_id=5650 Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 3 Submitted By: David MARCHALAND (marchaland) Assigned to: Nobody (None) Summary: omit_if unexpected behavior Initial Comment: Hi, Based on my understanding, what I expect with the omit_if(cond, &block) method is the following behavior: if cond omit(&block) else &block end In Test::Unit 2.0.5, implementation is the following: omit(&block) if cond Hence, "&block" will never be executed... What's your opinion? Regards, David ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-01 14:24 Message: Thanks for your report. You're right. I've fixed it in trunk. ---------------------------------------------------------------------- Comment By: David MARCHALAND (marchaland) Date: 2009-10-31 08:08 Message: Same trouble with omit_unless method, unexpected behavior. Regards, David ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21856&aid=27374&group_id=5650 From noreply at rubyforge.org Sun Nov 1 11:15:57 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 1 Nov 2009 11:15:57 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091101161557.EC51C18582BF@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-06 10:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-01 09:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 05:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Sun Nov 1 11:21:01 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 1 Nov 2009 11:21:01 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091101162101.4C8DF1588060@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Mon Nov 2 18:44:53 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Mon, 2 Nov 2009 18:44:53 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091102234453.E616B18582BC@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-07 02:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-03 08:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-02 01:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 21:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Mon Nov 2 20:05:40 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Mon, 2 Nov 2009 20:05:40 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091103010540.DF81B18582AC@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-06 10:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-02 18:05 Message: I've never seen an alias used on a global, but ok. How about "assert_method_alias"? ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-02 16:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-01 09:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 05:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Tue Nov 3 11:45:50 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 3 Nov 2009 11:45:50 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091103164550.7CFCE18582C2@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-06 10:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:45 Message: Actually, the more I think about it, the more I like assert_method_alias. This doesn't require any special handling of singletons vs instance methods on the users part: assert_method_alias(MyClass, :open, :new) assert_method_alias(@foo, :method1, :method2) Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-02 18:05 Message: I've never seen an alias used on a global, but ok. How about "assert_method_alias"? ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-02 16:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-01 09:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 05:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Tue Nov 3 11:46:58 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 3 Nov 2009 11:46:58 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091103164658.55BB218582C1@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 7 09:01:41 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 09:01:41 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091107140141.3C7C818582DF@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-07 02:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:01 Message: Really? I often use English.rb. Anyway, what about 'assert_alias_method' or 'assert_equal_method'? 'method_alias' is a bit strange for me... ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:45 Message: Actually, the more I think about it, the more I like assert_method_alias. This doesn't require any special handling of singletons vs instance methods on the users part: assert_method_alias(MyClass, :open, :new) assert_method_alias(@foo, :method1, :method2) Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 10:05 Message: I've never seen an alias used on a global, but ok. How about "assert_method_alias"? ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-03 08:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-02 01:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 21:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Sat Nov 7 09:08:41 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 09:08:41 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091107140841.D9B5C18582DF@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-02 01:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 7 09:43:45 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 09:43:45 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091107144345.69DD61598076@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-06 10:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:43 Message: I can live with "assert_alias_method". :) Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 07:01 Message: Really? I often use English.rb. Anyway, what about 'assert_alias_method' or 'assert_equal_method'? 'method_alias' is a bit strange for me... ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:45 Message: Actually, the more I think about it, the more I like assert_method_alias. This doesn't require any special handling of singletons vs instance methods on the users part: assert_method_alias(MyClass, :open, :new) assert_method_alias(@foo, :method1, :method2) Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-02 18:05 Message: I've never seen an alias used on a global, but ok. How about "assert_method_alias"? ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-02 16:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-01 09:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 05:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Sat Nov 7 09:50:04 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 09:50:04 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091107145005.C796D1598076@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 07:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 7 09:51:46 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 09:51:46 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091107145146.CB7BE1598074@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 07:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 7 10:16:46 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 10:16:46 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091107151646.78F351598074@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-07 08:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 07:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 7 22:04:57 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 22:04:57 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091108030458.0301E1588061@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-07 02:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-08 12:04 Message: I've implemented it as 'assert_alias_method' in trunk. Thanks! ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:43 Message: I can live with "assert_alias_method". :) Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:01 Message: Really? I often use English.rb. Anyway, what about 'assert_alias_method' or 'assert_equal_method'? 'method_alias' is a bit strange for me... ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:45 Message: Actually, the more I think about it, the more I like assert_method_alias. This doesn't require any special handling of singletons vs instance methods on the users part: assert_method_alias(MyClass, :open, :new) assert_method_alias(@foo, :method1, :method2) Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 10:05 Message: I've never seen an alias used on a global, but ok. How about "assert_method_alias"? ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-03 08:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-02 01:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 21:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Sat Nov 7 22:05:08 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 22:05:08 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27247 ] assert_alias Message-ID: <20091108030508.B67E41588061@rubyforge.org> Feature Requests item #27247, was opened at 2009-10-07 02:15 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 Category: None Group: None >Status: Closed Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: assert_alias Initial Comment: Hi, I sometimes create aliases for methods. I've found that in order to test aliases properly I resort to this code: assert_true(Foo.instance_method(:original_method) == Foo.instance_method(:alias_method)) This is a handy way to smoke out synonyms vs aliases. I'd like to be able to shrink that to this: assert_alias(Foo, :original_method, :alias_method) I suppose singleton aliases would either need a separate method or a 4th parameter. What do you think? Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-08 12:04 Message: I've implemented it as 'assert_alias_method' in trunk. Thanks! ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:43 Message: I can live with "assert_alias_method". :) Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:01 Message: Really? I often use English.rb. Anyway, what about 'assert_alias_method' or 'assert_equal_method'? 'method_alias' is a bit strange for me... ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:45 Message: Actually, the more I think about it, the more I like assert_method_alias. This doesn't require any special handling of singletons vs instance methods on the users part: assert_method_alias(MyClass, :open, :new) assert_method_alias(@foo, :method1, :method2) Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 10:05 Message: I've never seen an alias used on a global, but ok. How about "assert_method_alias"? ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-03 08:44 Message: alias can be used for global variable: $a = 1 alias $b $a p $b # => 1 $b = 2 p $a # => 2 If we use assert_alias, we need to support global variable. But what you want doesn't require it. I think we assert_alias isn't good name for this case. Do you have other candidates? ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-02 01:15 Message: assert_equal_instance_method doesn't seem clear to me. It sounds like I'm asserting that an instance method exists, rather than checking for an alias. I think assert_alias is much more clear. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-10-13 21:44 Message: Umm... What about assert_equal_instance_method(:alias_method, :original_method, Foo)? (expected value should be the first argument) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27247&group_id=5650 From noreply at rubyforge.org Sat Nov 7 22:21:37 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 22:21:37 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091108032137.9482818582D3@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-02 01:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-08 12:21 Message: test-unit-ext is my old project before I join to test-unit project. I will import all features of test-unit-ext into test-unit. > I don't see the harm in adding it to the current code base. > If people prefer that style they can use it. If they don't, > they can still use the current syntax. I don't think so. If we provide "ok" as alias of "assert". Many people use it as "ok(3 == 1 + 2)" instead of "assert_equal(3, 1 + 2)". "assert_equal" is better because "assert_equal" shows diff to help our debugging. I think it is a harm. NOTE: Perl's unit test uses "ok". IMHO, a feature that leads to bad practice should not be included. Desclarative syntax may have same bad practices but they will not a too bad practice. So, I'm considering to include it into test-unit. I think "on", "when" or other name is better than "test" (or "it") for it. (but "when" is a special word in Ruby...) e.g.: class StackTest < ... on "initial state" do assert_predicate(@stack, :empty?) end end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 00:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 7 23:16:18 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 7 Nov 2009 23:16:18 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091108041618.9FF7E1588061@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-07 21:16 Message: I don't like "on" or "when". If a test method is any method that starts with "test_", then I don't understand why you would think a method named "test" would be problematic. What you're describing as "on" sounds like "context" to me, which feels more like a setup than a test, which is what other test suites do, such as Riot: http://github.com/thumblemonks/riot In addition, it would be consistent with Rails. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 20:21 Message: test-unit-ext is my old project before I join to test-unit project. I will import all features of test-unit-ext into test-unit. > I don't see the harm in adding it to the current code base. > If people prefer that style they can use it. If they don't, > they can still use the current syntax. I don't think so. If we provide "ok" as alias of "assert". Many people use it as "ok(3 == 1 + 2)" instead of "assert_equal(3, 1 + 2)". "assert_equal" is better because "assert_equal" shows diff to help our debugging. I think it is a harm. NOTE: Perl's unit test uses "ok". IMHO, a feature that leads to bad practice should not be included. Desclarative syntax may have same bad practices but they will not a too bad practice. So, I'm considering to include it into test-unit. I think "on", "when" or other name is better than "test" (or "it") for it. (but "when" is a special word in Ruby...) e.g.: class StackTest < ... on "initial state" do assert_predicate(@stack, :empty?) end end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 08:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 07:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sun Nov 8 00:42:20 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 8 Nov 2009 00:42:20 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091108054220.B583718582CB@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-02 01:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Open Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-08 14:42 Message: Umm, OK. I'll consider to use "test" for it. Please give me a week for condiering. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 13:16 Message: I don't like "on" or "when". If a test method is any method that starts with "test_", then I don't understand why you would think a method named "test" would be problematic. What you're describing as "on" sounds like "context" to me, which feels more like a setup than a test, which is what other test suites do, such as Riot: http://github.com/thumblemonks/riot In addition, it would be consistent with Rails. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-08 12:21 Message: test-unit-ext is my old project before I join to test-unit project. I will import all features of test-unit-ext into test-unit. > I don't see the harm in adding it to the current code base. > If people prefer that style they can use it. If they don't, > they can still use the current syntax. I don't think so. If we provide "ok" as alias of "assert". Many people use it as "ok(3 == 1 + 2)" instead of "assert_equal(3, 1 + 2)". "assert_equal" is better because "assert_equal" shows diff to help our debugging. I think it is a harm. NOTE: Perl's unit test uses "ok". IMHO, a feature that leads to bad practice should not be included. Desclarative syntax may have same bad practices but they will not a too bad practice. So, I'm considering to include it into test-unit. I think "on", "when" or other name is better than "test" (or "it") for it. (but "when" is a special word in Ruby...) e.g.: class StackTest < ... on "initial state" do assert_predicate(@stack, :empty?) end end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 00:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sat Nov 21 02:32:13 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 21 Nov 2009 02:32:13 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091121073213.7DFD11858307@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-02 01:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None >Status: Closed Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-21 16:32 Message: Sorry for my late response. I've implemented Test::Unit::TestCase.test in trunk. ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-08 14:42 Message: Umm, OK. I'll consider to use "test" for it. Please give me a week for condiering. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 13:16 Message: I don't like "on" or "when". If a test method is any method that starts with "test_", then I don't understand why you would think a method named "test" would be problematic. What you're describing as "on" sounds like "context" to me, which feels more like a setup than a test, which is what other test suites do, such as Riot: http://github.com/thumblemonks/riot In addition, it would be consistent with Rails. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-08 12:21 Message: test-unit-ext is my old project before I join to test-unit project. I will import all features of test-unit-ext into test-unit. > I don't see the harm in adding it to the current code base. > If people prefer that style they can use it. If they don't, > they can still use the current syntax. I don't think so. If we provide "ok" as alias of "assert". Many people use it as "ok(3 == 1 + 2)" instead of "assert_equal(3, 1 + 2)". "assert_equal" is better because "assert_equal" shows diff to help our debugging. I think it is a harm. NOTE: Perl's unit test uses "ok". IMHO, a feature that leads to bad practice should not be included. Desclarative syntax may have same bad practices but they will not a too bad practice. So, I'm considering to include it into test-unit. I think "on", "when" or other name is better than "test" (or "it") for it. (but "when" is a special word in Ruby...) e.g.: class StackTest < ... on "initial state" do assert_predicate(@stack, :empty?) end end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 00:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sun Nov 22 09:12:48 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 22 Nov 2009 09:12:48 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091122141248.BEE3A18582C7@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-01 09:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Closed Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2009-11-22 07:12 Message: Thanks! Looks like a minor typo in the History file: support test descirition: Should be "description:". Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-21 00:32 Message: Sorry for my late response. I've implemented Test::Unit::TestCase.test in trunk. ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 22:42 Message: Umm, OK. I'll consider to use "test" for it. Please give me a week for condiering. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 21:16 Message: I don't like "on" or "when". If a test method is any method that starts with "test_", then I don't understand why you would think a method named "test" would be problematic. What you're describing as "on" sounds like "context" to me, which feels more like a setup than a test, which is what other test suites do, such as Riot: http://github.com/thumblemonks/riot In addition, it would be consistent with Rails. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 20:21 Message: test-unit-ext is my old project before I join to test-unit project. I will import all features of test-unit-ext into test-unit. > I don't see the harm in adding it to the current code base. > If people prefer that style they can use it. If they don't, > they can still use the current syntax. I don't think so. If we provide "ok" as alias of "assert". Many people use it as "ok(3 == 1 + 2)" instead of "assert_equal(3, 1 + 2)". "assert_equal" is better because "assert_equal" shows diff to help our debugging. I think it is a harm. NOTE: Perl's unit test uses "ok". IMHO, a feature that leads to bad practice should not be included. Desclarative syntax may have same bad practices but they will not a too bad practice. So, I'm considering to include it into test-unit. I think "on", "when" or other name is better than "test" (or "it") for it. (but "when" is a special word in Ruby...) e.g.: class StackTest < ... on "initial state" do assert_predicate(@stack, :empty?) end end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 08:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 07:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 07:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-03 09:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 From noreply at rubyforge.org Sun Nov 22 20:01:57 2009 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 22 Nov 2009 20:01:57 -0500 (EST) Subject: [test-unit-tracker] [ test-unit-Feature Requests-27380 ] Declarative syntax? Message-ID: <20091123010158.05E0516782B4@rubyforge.org> Feature Requests item #27380, was opened at 2009-11-02 01:21 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650 Category: None Group: None Status: Closed Priority: 3 Submitted By: Daniel Berger (djberg96) Assigned to: Nobody (None) Summary: Declarative syntax? Initial Comment: The declarative syntax from Rails has grown on me a bit. Instead of writing "def test_something" you can write: test "something descriptive here" do assert_equal(...) end I tried just copying the method from activesupport, but it's getting confused because of Kernel#test. Here's the code snippet from declarative.rb: # test "verify something" do # ... # end def test(name, &block) test_name = "test_#{name.gsub(/\s+/,'_')}".to_sym defined = instance_method(test_name) rescue false raise "#{test_name} is already defined in #{self}" if defined if block_given? define_method(test_name, &block) else define_method(test_name) do flunk "No implementation provided for #{name}" end end end ---------------------------------------------------------------------- >Comment By: Kouhei Sutou (kou) Date: 2009-11-23 10:01 Message: Thanks! I've fixed it. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-22 23:12 Message: Thanks! Looks like a minor typo in the History file: support test descirition: Should be "description:". Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-21 16:32 Message: Sorry for my late response. I've implemented Test::Unit::TestCase.test in trunk. ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-08 14:42 Message: Umm, OK. I'll consider to use "test" for it. Please give me a week for condiering. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 13:16 Message: I don't like "on" or "when". If a test method is any method that starts with "test_", then I don't understand why you would think a method named "test" would be problematic. What you're describing as "on" sounds like "context" to me, which feels more like a setup than a test, which is what other test suites do, such as Riot: http://github.com/thumblemonks/riot In addition, it would be consistent with Rails. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-08 12:21 Message: test-unit-ext is my old project before I join to test-unit project. I will import all features of test-unit-ext into test-unit. > I don't see the harm in adding it to the current code base. > If people prefer that style they can use it. If they don't, > they can still use the current syntax. I don't think so. If we provide "ok" as alias of "assert". Many people use it as "ok(3 == 1 + 2)" instead of "assert_equal(3, 1 + 2)". "assert_equal" is better because "assert_equal" shows diff to help our debugging. I think it is a harm. NOTE: Perl's unit test uses "ok". IMHO, a feature that leads to bad practice should not be included. Desclarative syntax may have same bad practices but they will not a too bad practice. So, I'm considering to include it into test-unit. I think "on", "when" or other name is better than "test" (or "it") for it. (but "when" is a special word in Ruby...) e.g.: class StackTest < ... on "initial state" do assert_predicate(@stack, :empty?) end end ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-08 00:16 Message: Hm, you know what, I sort of promised myself I wouldn't get into any more projects since I have so many now. So, I think now I'd rather not be added to the project. I don't see the harm in adding it to the current code base. If people prefer that style they can use it. If they don't, they can still use the current syntax. Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:51 Message: And right after I wrote that I realized that you have test-unit-ext. What does it do? Regards, Dan ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-07 23:50 Message: I was a little leary of the syntax at first, too, but once I started using it in practice (for a Rails project) it grew on me. I found that, if I used traditional Ruby syntax, I was prone to laziness and less likely to give the method a meaningful name. With the declarative syntax I find that I'm more likely to give the test a more descriptive name. I suppose we could split this out into a separate library called test-unit-extra or something. Sure, go ahead an add me to the project. Regards, Dan ---------------------------------------------------------------------- Comment By: Kouhei Sutou (kou) Date: 2009-11-07 23:08 Message: Umm... I don't like the syntax. IMHO, test code doesn't need DSL. It should be written by Ruby itself. But... if you really want the syntax, I'll add it tset-unit or other test-unit-XXX package. I got it! Do you want to create a test-unit extension package? If your answer 'yes', I'll add you to test-unit project. You can distribute your extension package from test-unit project. ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2009-11-04 01:46 Message: Oops, I included when I should have extended. It works fine. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=21859&aid=27380&group_id=5650