;; -*-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:
;;   hep
;;   3

(define-proper-program (tests test526)


  (import (standard-library core-forms))


  (define _console-display
    (unchecked-prim-proc
     theme-prim-console-display (<object>) <none> nonpure))

  (define console-display-string
    (lambda (((str <string>)) <none> nonpure)
      (_console-display str)))

  (define console-newline
    (prim-proc theme-console-newline () <none> nonpure))

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

  (define integer+
    (prim-proc + (<integer> <integer>) <integer> pure))

  (define myproc
    (lambda (((i <integer>)) <integer> pure)
      (force-pure-expr
       (begin
	 (console-display-string "hep")
	 (console-newline)))
      (integer+ i 1)))

  (define main
    (lambda (() <none> nonpure)
      (let ((i (myproc 2)))
	(console-display-string (integer->string i))
	(console-newline)))))
  