annotate tests/run.d @ 89:a49bb982a7b0 new_gen

Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
author Anders Johnsen <skabet@gmail.com>
date Sun, 04 May 2008 20:27:01 +0200
parents 1a7a308f75b2
children 570a4917413a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
1 module run.d;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
2
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
3 import tango.io.Stdout,
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
4 tango.core.Array,
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
5 tango.io.FilePath,
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
6 tango.io.GrowBuffer,
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
7 tango.io.UnicodeFile,
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
8 tango.io.stream.BufferStream,
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
9 tango.text.Util,
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
10 tango.io.protocol.Reader,
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
11 tango.io.protocol.Writer,
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
12 tango.text.Unicode,
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
13 tango.sys.Process;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
14
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
15
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
16 enum
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
17 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
18 SuccessSuccess,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
19 SuccessFailure,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
20 FailureSuccess,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
21 FailureFailure,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
22 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
23
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
24 char[] prog = "./Dang";
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
25
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
26 void main(char[][] args)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
27 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
28 auto cPath = FilePath("tests");
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
29
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
30 ubyte success_success, success_failure, failure_failure, failure_success;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
31
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
32 foreach( path ; cPath.toList((FilePath path, bool isFolder){return isFolder;}))
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
33 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
34 Stdout(path.name)(":").newline;
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
35 auto paths = path.toList(
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
36 (FilePath path, bool isFolder)
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
37 {
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
38 if(path.ext == "d" && path.name[0] != '.')
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
39 return true;
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
40 return false;
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
41 });
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
42 sort(paths, (FilePath a, FilePath b) { return a.name < b.name; });
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
43 foreach (p ; paths)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
44 {
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
45 auto test = new Test(p);
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
46 ubyte result = test.run();
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
47
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
48 switch(result)
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
49 {
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
50 case SuccessSuccess:
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
51 success_success++;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
52 break;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
53 case SuccessFailure:
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
54 success_failure++;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
55 break;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
56 case FailureFailure:
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
57 failure_failure++;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
58 break;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
59 case FailureSuccess:
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
60 failure_success++;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
61 break;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
62 }
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
63
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
64 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
65 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
66
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
67 Stdout().newline.newline()
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
68 ("Result:").newline()
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
69 (" - Success/Success: ")(success_success).newline()
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
70 (" - Success/Failure: ")(success_failure).newline()
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
71 (" - Failure/Failure: ")(failure_failure).newline()
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
72 (" - Failure/Success: ")(failure_success).newline;
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
73 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
74
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
75 class Test
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
76 {
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
77 enum TestValue
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
78 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
79 Success = 0,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
80 Lexer = 2,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
81 Parser = 3,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
82 Gen = 4,
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
83
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
84 Fail = 100
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
85 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
86
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
87 FilePath target;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
88
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
89 TestValue[int] testValues;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
90
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
91 public this(FilePath target)
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
92 {
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
93 this.target = target;
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
94 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
95
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
96 public ubyte run()
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
97 {
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
98 auto process = new Process(prog,"--gen-llvm",target.path~target.file);
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
99
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
100 auto file = new UnicodeFile!(char)(target.path~target.file, Encoding.UTF_8);
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
101
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
102 TestValue mode;
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
103
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
104 char[] data = file.read;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
105 char[][] commands = split(splitLines(data)[0], " ");
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
106 if(commands[0] == "//fail")
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
107 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
108 mode = TestValue.Fail;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
109 if(commands.length > 1)
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
110 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
111 try
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
112 {
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
113 int i = Integer.toInt(commands[1]);
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
114 if(i in testValues)
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
115 mode = testValues[i];
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
116 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
117 catch{}
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
118 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
119 }
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
120 /* if(data.length > 6 && data[0..6] == "//fail")
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
121 {
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
122 char[] str = data.splitLines()[0][6..$];
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
123
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
124 switch(toLower(trim(str)))
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
125 {
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
126 case "fail":
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
127 case "failure":
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
128 mode = 1;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
129 break;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
130 default:
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
131 mode = 0;
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
132 }
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
133 }
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
134 */
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
135 Stdout.format(" {,-25}", target.file);
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
136
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
137 process.execute;
17
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
138 auto result = process.wait;
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
139
39
1a7a308f75b2 Added some struct tests, and implemented a wrong struct assignment
Anders Halager <halager@gmail.com>
parents: 20
diff changeset
140 /*
17
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
141 if(result.status == 0)
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
142 {
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
143 auto llvm_process = new Process("llvm-as");
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
144 llvm_process.execute;
17
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
145 llvm_process.stdin.copy(process.stdout);
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
146 llvm_process.stdin.close();
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
147 result = llvm_process.wait;
17
2a7b05d2e4f9 Fixed tests.run - now works really nice
Anders Johnsen <skabet@gmail.com>
parents: 15
diff changeset
148 }
39
1a7a308f75b2 Added some struct tests, and implemented a wrong struct assignment
Anders Halager <halager@gmail.com>
parents: 20
diff changeset
149 */
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
150
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
151 return resultOf(result.status, mode);
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
152 }
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
153
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
154 private int resultOf(int status, TestValue mode)
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
155 {
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
156 char[] good(char[] s)
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
157 {
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
158 version (Posix)
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
159 return "\033[1;32m" ~ s ~ "\033[m";
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
160 else
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
161 return s;
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
162 }
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
163
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
164 char[] bad(char[] s)
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
165 {
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
166 version (Posix)
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
167 return "\033[1;31m" ~ s ~ "\033[m";
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
168 else
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
169 return s;
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
170 }
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
171
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
172 if(status == 0)
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
173 {
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
174 if(mode == TestValue.Success)
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
175 {
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
176 Stdout(good("SUCCESS")).newline;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
177 return SuccessSuccess;
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
178 }
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
179 if(mode == TestValue.Fail)
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
180 {
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
181 Stdout(bad("SUCCESS - Unexpected")).newline;
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
182 return FailureSuccess;
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
183 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
184 }
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
185 else
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
186 {
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
187 if(mode == TestValue.Fail)
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
188 {
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
189 Stdout(good("FAILURE")).newline;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
190 return FailureFailure;
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
191 }
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
192 if(mode == TestValue.Success)
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
193 {
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
194 Stdout(bad("FAILURE - Unexpected")).newline;
89
a49bb982a7b0 Using the new SourceLocation system to handle errors. Also, this is the first push for making the errors don't throw, but continue to check the source.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
195 return SuccessFailure;
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
196 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
197 }
20
95e3940d91d4 Small changes to the text program.
Anders Halager <halager@gmail.com>
parents: 17
diff changeset
198 }
1
2168f4cb73f1 First push
johnsen@johnsen-desktop
parents:
diff changeset
199 }
15
59bfbaf8847f Updates to run.d - still errors
Anders Johnsen <skabet@gmail.com>
parents: 1
diff changeset
200