summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/runnable/testline.d
blob: 5001fc2fa681a8b22fc49c0c0e4e4d0fc80c9763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// PERMUTE_ARGS:

// $HeadURL$
// $Date$
// $Author$

module dstress.run.line_token_03;

import std.stdio;
import core.exception;

int main(){
        try{
                #line 1 ""
                assert(0);
        }catch(AssertError o){
                checkFileSpec(o);
                return 0;
        }

        assert(0);
}

import std.stdio;

/*
 * @WARNING@: this code depends on the phobos implementation.
 * char[]s returned by wrong assertions have to look like:
 *       "blah blah "filename" blah blah"
 */
void checkFileSpec(Object o){
        string str=o.toString();

        int start;
        for(start=0; start<str.length; start++){
                if(str[start]=='('){
                        break;
                }
        }

writeln(str);
        assert(str[start .. start+3]=="(1)");
}
// RUNNABLE_PHOBOS_TEST