;; -*-theme-d-*-

;; Copyright (C) 2015 Tommi Höynälänmaa
;; Distributed under GNU General Public License version 3,
;; see file doc/GPL-3.

;; Expected results: translation and running OK

;; Expected output:
;;   abc
;;   2

(define-proper-program (tests test521)

  (import (standard-library core)
	  (standard-library console-io))

  (define integer->string
    (prim-proc number->string (<integer>) <string> pure))

  (define-simple-proc main (() <none> nonpure)
    (let ((i <integer>
	     (guard-nonpure (exc
			     ((integer? exc)
			      (console-display-string
			       (integer->string (cast <integer> exc)))
			      (console-newline)
			      1)
			     ((string? exc)
			      (console-display-string (cast <string> exc))
			      (console-newline)
			      2))
			    (raise "abc")
			    0)))
      (console-display-string (integer->string i))
      (console-newline))))

