Corrected bug in statements after loop, running same language in two

windows/tabs, substring off by one error, spelling error in error message

svn: r2591
This commit is contained in:
Kathy Gray 2006-04-04 17:42:06 +00:00
parent 740a1bd826
commit 524dbb1cbe
4 changed files with 78 additions and 53 deletions

View File

@ -1108,7 +1108,7 @@
(define (check-while cond/env src check-s loop-body)
((check-cond 'while) (type/env-t cond/env) src)
(check-s loop-body (type/env-e cond/env) #t #f)
(make-type/env 'void (type/env-t cond/env)))
(make-type/env 'void (type/env-e cond/env)))
;check-do: (exp env -> type/env) exp src type/env -> type/env
(define (check-do check-e exp src loop/env)
@ -2746,7 +2746,7 @@
((method-name)
(let ((line1
(format "Method ~a is being erroneously accessed as a field for class ~a." field t))
(line2 "A call to a method chould be followed by () and any arguments to the method"))
(line2 "A call to a method should be followed by () and any arguments to the method"))
(format "~a~n~a" line1 line2)))
((array)
(format "~a only has a length field, attempted to access ~a" t field))

View File

@ -733,7 +733,7 @@
(when (>= begin (string-length text))
(raise (make-runtime-error
(format "First argument to substring must be smaller than the string's length ~a, given ~a." (string-length text) begin))))
(when (>= end (string-length text))
(when (> end (string-length text))
(raise (make-runtime-error
(format "Second argument to substring must be smaller than the string's length ~a, given ~a." (string-length text) end))))
(when (< end 0)

View File

@ -465,6 +465,7 @@
[class-path ((current-module-name-resolver) '(lib "class.ss") #f #f)]
[mred-path ((current-module-name-resolver) '(lib "mred.ss" "mred") #f #f)]
[n (current-namespace)])
(let ((execute-types (create-type-record)))
(read-case-sensitive #t)
(run-in-user-thread
(lambda ()
@ -477,6 +478,7 @@
((parse-java-full-program ex)
(let ((exp (old-current-eval (syntax ex))))
(execution? #t)
(set! execute-types (create-type-record))
(let ((name-to-require #f))
(let loop ((mods (order (compile-ast exp level execute-types)))
(extras (process-extras
@ -514,7 +516,7 @@
(namespace-require mred-path)
(namespace-require '(prefix javaRuntime: (lib "runtime.scm" "profj" "libs" "java")))
(namespace-require '(prefix c: (lib "contract.ss")))
)))))
))))))
#;(define/public (render-value value settings port); port-write)
(let ((print-full? (profj-settings-print-full? settings))

View File

@ -1,10 +1,26 @@
(module advanced-tests mzscheme
(require (lib "profj-testing.ss" "profj"))
(require (lib "String.ss" "profj" "libs" "java" "lang"))
(prepare-for-tests "Advanced")
;;Execution tests without errors
(execute-test
"class Blah {
Blah () {}
int addUp (int top) {
int answer = 0;
int counter = 1;
while (counter <= top) {
answer += counter;
++counter;
}
return answer;
}
}"
'advanced #f "while loop with statements after")
(execute-test
"interface A { int a( int x); }
abstract class B implements A { }
@ -325,6 +341,13 @@ class WeeklyPlanner{
(list '(void) 'o~f)
"Casting to a String")
(interact-test
'advanced
(list "\"hello\".substring(2,5)")
(list (make-java-string "llo"))
"Test of substring")
(report-test-results)
)