www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - unittest and compiling

reply "ElfQT" <dethjunk yahoo.com> writes:
<code>
private import std.stdio;

int main(char[][] args)
{
 return 0;
}

unittest
{
 float f = 1.0f;
 char[] c = toString(f);
}
</code>

<compiling>
dmd.exe test.d
 -> OK

dmd.exe test.d -unittest
Unittest.d(11): undefined identifier toString
Unittest.d(11): function expected before (), not toString of type int
Unittest.d(11): cannot implicitly convert expression (toString(f)) of type 
int to char[]
</compiling> 
Sep 05 2005
parent reply Dave <Dave_member pathlink.com> writes:
You need to import std.string too.

In article <dfij6n$2n20$1 digitaldaemon.com>, ElfQT says...
<code>
private import std.stdio;

int main(char[][] args)
{
 return 0;
}

unittest
{
 float f = 1.0f;
 char[] c = toString(f);
}
</code>

<compiling>
dmd.exe test.d
 -> OK

dmd.exe test.d -unittest
Unittest.d(11): undefined identifier toString
Unittest.d(11): function expected before (), not toString of type int
Unittest.d(11): cannot implicitly convert expression (toString(f)) of type 
int to char[]
</compiling> 
Sep 06 2005
parent "ElfQT" <dethjunk yahoo.com> writes:
Doh, I forgot that, when I tried to near down a reproduce the error with a 
small example.
The real error is still mine: I've tried to mixin a template, where the 
template was in another file. And std.string was private in the referred 
file containing the template also not imperted in the file trying to mixin.
Thanks,
ElfQT 
Sep 06 2005