#!/usr/bin/env python
import os
from coral.modeler import modeler,action


m=modeler.ModelerWindow()
m.main(loop=0)

action.newProject(["UML",1,4])


action.shellSetCurrentScript("print 2+2\n")
action.shellExecuteCurrentScript()

s= action.shellGetOutput()
assert(s=="4\n")

action.shellClear()
action.shellOpenScript("script.txt")
action.shellExecuteCurrentScript()

print action.shellGetOutput()
print action.shellSaveScript("script2.txt")

fd1=open("script.txt","r")
try:
    l1=fd1.readlines()
finally:
    fd1.close()

fd2=open("script2.txt","r")
try:
    l2=fd2.readlines()
finally:
    fd2.close()

for i in range(len(l1)):
    assert(l1[i]==l2[i])

action.openDocumentationBrowser()

action.quit()
