Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 1750

Show
Ignore:
Timestamp:
07/12/10 00:51:02 (14 years ago)
Author:
andrei
Message:

Eliminated unittests for built-in complex.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/phobos/std/stdio.d

    r1725 r1750  
    8080    alias __fp_unlock FUNLOCK; 
    8181 
    8282    alias setmode _setmode; 
    8383    enum _O_BINARY = 0x8000; 
    8484    int _fileno(FILE* f) { return f._file; } 
    8585} 
    8686else version (GCC_IO) 
    8787{ 
    8888    /* ** 
    8989     * Gnu under-the-hood C I/O functions; see 
    90      * http://www.gnu.org/software/libc/manual/html_node/I_002fO-on-Streams.html#I_002fO-on-Streams 
     90     * http://gnu.org/software/libc/manual/html_node/I_002fO-on-Streams.html 
    9191     */ 
    92     //private import std.c.linux.linux; 
    9392    private import core.sys.posix.stdio; 
    9493    extern (C) 
    9594    { 
    9695        int fputc_unlocked(int, _iobuf*); 
    9796        int fputwc_unlocked(wchar_t, _iobuf*); 
    9897        int fgetc_unlocked(_iobuf*); 
    9998        int fgetwc_unlocked(_iobuf*); 
    10099        void flockfile(FILE*); 
    101100        void funlockfile(FILE*); 
    102101        ssize_t getline(char**, size_t*, FILE*); 
     
    615614 
    616615/** 
    617616If the file is not opened, throws an exception. Otherwise, writes its 
    618617arguments in text format to the file, according to the format in the 
    619618first argument. */ 
    620619    void writef(S...)(S args)// if (isSomeString!(S[0])) 
    621620    { 
    622621        assert(p); 
    623622        assert(p.handle); 
    624623        static assert(isSomeString!(S[0]), errorMessage); 
    625         auto w = lockingTextWriter
     624        auto w = lockingTextWriter()
    626625        std.format.formattedWrite(w, args); 
    627626    } 
    628627 
    629628/** 
    630629Same as writef, plus adds a newline. */ 
    631630    void writefln(S...)(S args) 
    632631    { 
    633632        static assert(isSomeString!(S[0]), errorMessage); 
    634633        auto w = lockingTextWriter; 
    635634        std.format.formattedWrite(w, args); 
     
    14821481    f.writefln("Hello, %s world number %s!", "nice", 42); 
    14831482    f.close; 
    14841483    version (Windows) 
    14851484        assert(cast(char[]) std.file.read(file) == 
    14861485                "Hello, nice world number 42!\r\n"); 
    14871486    else 
    14881487        assert(cast(char[]) std.file.read(file) == 
    14891488                "Hello, nice world number 42!\n", 
    14901489                cast(char[]) std.file.read(file)); 
    14911490    // test write on stdout 
    1492     auto saveStdout = stdout; 
    1493     scope(exit) stdout = saveStdout; 
    1494     stdout.open(file, "w"); 
    1495     assert(stdout.isOpen); 
    1496     writefln("Hello, %s world number %s!", "nice", 42); 
    1497     foreach (F ; TypeTuple!(ifloat, idouble, ireal)) 
    1498    
    1499         F a = 5i; 
    1500         F b = a % 2; 
    1501         writeln(b); 
    1502    
    1503     stdout.close; 
    1504     auto read = cast(char[]) std.file.read(file); 
    1505     version (Windows) 
    1506         assert(read == "Hello, nice world number 42!\r\n1\r\n1\r\n1\r\n", read); 
    1507     else 
    1508         assert(read == "Hello, nice world number 42!\n1\n1\n1\n", "["~read~"]"); 
     1491    // auto saveStdout = stdout; 
     1492    // scope(exit) stdout = saveStdout; 
     1493    // stdout.open(file, "w"); 
     1494    // assert(stdout.isOpen); 
     1495    // writefln("Hello, %s world number %s!", "nice", 42); 
     1496    // foreach (F ; TypeTuple!(ifloat, idouble, ireal)) 
     1497    //
     1498    //     F a = 5i; 
     1499    //     F b = a % 2; 
     1500    //     writeln(b); 
     1501    //
     1502    // stdout.close; 
     1503    // auto read = cast(char[]) std.file.read(file); 
     1504    // version (Windows) 
     1505    //     assert(read == "Hello, nice world number 42!\r\n1\r\n1\r\n1\r\n", read); 
     1506    // else 
     1507    //     assert(read == "Hello, nice world number 42!\n1\n1\n1\n", "["~read~"]"); 
    15091508} 
    15101509 
    15111510/** 
    15121511 * Formatted read one line from stdin. 
    15131512 */ 
    15141513void readf(A...)(in char[] format, A args) 
    15151514{ 
    15161515    return stdin.readf(format, args); 
    15171516} 
    15181517