www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - unittest for nested functions?

reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Should unittest in functions be allowed in future, so that static inner
functions can be tested? 

# void outer(){
# 	static int inner(){
#		return 0;
#	} 
#
#	unittest{
#		assert(inner()==0);
#	}
# }

Thomas


-----BEGIN PGP SIGNATURE-----

iD8DBQFCZe4h3w+/yD4P9tIRAsZiAKCqXhIB4zSoe5ctT4ALasyXGOZWbwCgqgyP
2FoEwP8wvVW7+OmDwJLUXP0=
=Tgr9
-----END PGP SIGNATURE-----
Apr 19 2005
parent reply "TechnoZeus" <TechnoZeus PeoplePC.com> writes:
Hmmm... Won't this work?...

unittest
{
  function.test();
  assert(foo);
  //etc.
}

TZ


"Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message
news:1a7hj2-uf6.ln1 lnews.kuehne.cn...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1


 Should unittest in functions be allowed in future, so that static inner
 functions can be tested?

 # void outer(){
 # static int inner(){
 # return 0;
 # }
 #
 # unittest{
 # assert(inner()==0);
 # }
 # }

 Thomas


 -----BEGIN PGP SIGNATURE-----

 iD8DBQFCZe4h3w+/yD4P9tIRAsZiAKCqXhIB4zSoe5ctT4ALasyXGOZWbwCgqgyP
 2FoEwP8wvVW7+OmDwJLUXP0=
 =Tgr9
 -----END PGP SIGNATURE-----

Apr 20 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

TechnoZeus schrieb am Wed, 20 Apr 2005 19:17:18 -0500:
 Hmmm... Won't this work?...

 unittest
 {
   function.test();
   assert(foo);
   //etc.
 }

 TZ


 "Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message
news:1a7hj2-uf6.ln1 lnews.kuehne.cn...
 Should unittest in functions be allowed in future, so that static inner
 functions can be tested?

 # void outer(){
 # static int inner(){
 # return 0;
 # }
 #
 # unittest{
 # assert(inner()==0);
 # }
 # }

 Thomas


Nice catch. BTW where is this documented? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCZzUH3w+/yD4P9tIRAmtJAKDLEsvU5Kn6H+lE5ieti12ayULyOgCfVizx HVz4XAbnmB91AIwBYQGhmwY= =v0i6 -----END PGP SIGNATURE-----
Apr 20 2005
parent "TechnoZeus" <TechnoZeus PeoplePC.com> writes:
Don't know if it is documented.  It just seemed to make sense.

TZ

"Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message
news:71pjj2-b54.ln1 lnews.kuehne.cn...
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1

 TechnoZeus schrieb am Wed, 20 Apr 2005 19:17:18 -0500:
 Hmmm... Won't this work?...

 unittest
 {
   function.test();
   assert(foo);
   //etc.
 }

 TZ


 "Thomas Kuehne" <thomas-dloop kuehne.thisisspam.cn> wrote in message
news:1a7hj2-uf6.ln1 lnews.kuehne.cn...
 Should unittest in functions be allowed in future, so that static inner
 functions can be tested?

 # void outer(){
 # static int inner(){
 # return 0;
 # }
 #
 # unittest{
 # assert(inner()==0);
 # }
 # }

 Thomas


Nice catch. BTW where is this documented? Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCZzUH3w+/yD4P9tIRAmtJAKDLEsvU5Kn6H+lE5ieti12ayULyOgCfVizx HVz4XAbnmB91AIwBYQGhmwY= =v0i6 -----END PGP SIGNATURE-----

Apr 21 2005