changeset 186:e1e170c2cd44

Fixed a error in the test program.
author Anders Johnsen <skabet@gmail.com>
date Fri, 25 Jul 2008 12:50:09 +0200
parents 7b274cfdc1dc
children 08b6ce45b456
files lexer/Lexer.d tests/lexer/Comments2.d tests/run.d
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lexer/Lexer.d	Fri Jul 25 12:18:05 2008 +0200
+++ b/lexer/Lexer.d	Fri Jul 25 12:50:09 2008 +0200
@@ -227,6 +227,7 @@
     }
     Token slash()
     {
+        int p = position;
         switch(source[position])
         {
             case '=':
@@ -250,7 +251,7 @@
                             return this.next;
                         }
                 }
-                messages.report(UnexpectedEOFBlock,Loc(position)).fatal(ExitLevel.Lexer);
+                messages.report(UnexpectedEOFBlock,Loc(p)).fatal(ExitLevel.Lexer);
 
             case '+':
                 position += 2;
@@ -277,7 +278,7 @@
                 }
                 messages.report(
                         UnexpectedEOFBlock,
-                        Loc(position)).fatal(ExitLevel.Lexer);
+                        Loc(p)).fatal(ExitLevel.Lexer);
 
             default:
                 return Token(Tok.Slash, Loc(position - 1), 1);
--- a/tests/lexer/Comments2.d	Fri Jul 25 12:18:05 2008 +0200
+++ b/tests/lexer/Comments2.d	Fri Jul 25 12:50:09 2008 +0200
@@ -1,4 +1,6 @@
 //fail
 
-/+ 
+/+
 
+
+
--- a/tests/run.d	Fri Jul 25 12:18:05 2008 +0200
+++ b/tests/run.d	Fri Jul 25 12:50:09 2008 +0200
@@ -101,6 +101,7 @@
     if (line.length >= 2 && line[0 .. 2] == "//")
     {
         foreach (command; line[2 .. $].delimiters(",;"))
+        {
             switch (toLower(substitute(command, " ", "")))
             {
                 case "skip", "dontcompile":
@@ -117,6 +118,8 @@
                 default:
                     break;
             }
+            break;
+        }
     }
 
     if (compile)
@@ -149,7 +152,7 @@
             return s;
     }
 
-    bool unexpected = (result != expected);
+    bool unexpected = expected == 0 ? result != 0 : result == 0;
     auto f = unexpected? &bad : &good;
     char[] s = (result == 0)? "SUCCESS" : "FAILURE";
     // always print if unexpeted, otherwise check the settings