} 1 {Too many superclasses specified in interface for class "EClass". Maximum is 3.}
Test 1.11 {
# Not enough args for constructor
otclInterface AClass {
constructor
}
} 1 {wrong # args: should be "constructor args"}
Test 1.12 {
# Too many args for constructor
otclInterface AClass {
constructor {} extra
}
} 1 {wrong # args: should be "constructor args"}
Test 1.13 {
# Formal arguemnt error in constructor
otclInterface AClass {
constructor {arg {}}
}
} 1 {Syntax error in formal argument 2 for method "AClass::constructor". Formal argument specification is "".}
Test 1.14 {
# Formal argument error in constructor
otclInterface AClass {
constructor {arg1 {arg2 value extra}}
}
} 1 {Syntax error in formal argument 2 for method "AClass::constructor". Formal argument specification is "arg2 value extra".}
Test 1.15 {
# Duplicated arguments in constructor
otclInterface AClass {
constructor {arg1 arg1}
}
} 1 {Duplicated formal argument "arg1" in method "AClass::constructor".}
Test 1.16 {
# Not enough args for method
otclInterface AClass {
method
}
} 1 {wrong # args: should be "method name args"}
Test 1.17 {
# Too many args for method
otclInterface AClass {
method name args extra
}
} 1 {wrong # args: should be "method name args"}
Test 1.18 {
# Invalid name for method
otclInterface AClass {
method constructor {}
}
} 1 {Cannot name an instance method "constructor".}
Test 1.19 {
# Invalid name for method
otclInterface AClass {
method destructor {}
}
} 1 {Cannot name an instance method "destructor".}
Test 1.20 {
# Method duplicated in interface
otclInterface AClass {
method methodOne {}
method methodOne {}
}
} 1 {Method "methodOne" duplicated in interface for class "AClass".}
Test 1.21 {
# Method duplicated in interface
otclInterface AClass {
classMethod methodOne {}
method methodOne {}
}
} 1 {Method "methodOne" duplicated in interface for class "AClass".}
Test 1.22 {
# Not enough args for classMethod
otclInterface AClass {
classMethod
}
} 1 {wrong # args: should be "classMethod name args"}
Test 1.23 {
# Too many args for classMethod
otclInterface AClass {
classMethod name arg extra
}
} 1 {wrong # args: should be "classMethod name args"}
Test 1.24 {
# Invalid name for classMethod
otclInterface AClasss {
classMethod constructor {}
}
} 1 {Cannot name a class method "constructor".}
Test 1.25 {
# Invalid name for classMethod
otclInterface AClass {
classMethod destructor {}
}
} 1 {Cannot name a class method "destructor".}
Test 1.26 {
# Duplicate method in interface
otclInterface AClass {
classMethod methodOne {}
classMethod methodOne {}
}
} 1 {Method "methodOne" duplicated in interface for class "AClass".}
Test 1.27 {
# Duplicate method in interface
otclInterface AClass {
method methodOne {}
classMethod methodOne {}
}
} 1 {Method "methodOne" duplicated in interface for class "AClass".}
Test 1.28 {
# Invalid argument in method
otclInterface AClass {
method methodOne {{}}
}
} 1 {Syntax error in formal argument 1 for method "AClass::methodOne". Formal argument specification is "".}
Test 2.1 {
# Not enough args for otclImplementation
otclImplementation
} 1 {wrong # args: should be "otclImplementation className body"}
Test 2.2 {
# Too many arguments for otclImplementation
# Max args only check after name has been checked
otclInterface name {}
otclImplementation name body extra
} 1 {wrong # args: should be "otclImplementation className body"}
Test 2.3 {
# Illegal class name for otclImplementation
otclImplementation AClass {}
} 1 {Class "AClass" interface has not been declared.}
Test 2.4 {
# Duplicate implementation
otclInterface AClass {}
otclImplementation AClass {}
otclImplementation AClass {}
} 1 {Class "AClass" has already been completely specified.}
Test 2.5 {
# Not enough args for constructor implementation
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
constructor
}
} 1 {wrong # args: should be "constructor args parentConstructors body"}
Test 2.6 {
# Too many args for constructor implementation
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
constructor args parentList body extra
}
} 1 {wrong # args: should be "constructor args parentConstructors body"}
Test 2.7 {
# Diff # args from int to imp for constructor
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
constructor {arg1} {} {}
}
} 1 {Method "AClass::constructor" has different number of arguments specified in its interface and implementation.}
Test 2.8 {
# Diff # args from int to imp for constructor
otclInterface AClass {
constructor {arg1}
}
otclImplementation AClass {
constructor {} {} {}
}
} 1 {Method "AClass::constructor" has different number of arguments specified in its interface and implementation.}
Test 2.9 {
# Default value for constructor specified in implementation
otclInterface AClass {
constructor {arg1}
}
otclImplementation AClass {
constructor {{arg1 0}} {} {}
}
} 1 {Method "AClass::constructor" has default values specified for formal arguments in its implementation. Can only specify defaults in interface if method is public.}
Test 2.10 {
# Parent constructor bad syntax
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
constructor {} {{}} {}
}
} 1 {Syntax error in parent constructor "" in constructor of class "AClass".}
Test 2.11 {
# Parent constructor bad syntax
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
constructor {} {{bad}} {}
}
} 1 {Syntax error in parent constructor "bad" in constructor of class "AClass".}
Test 2.12 {
# Unknown class in parent construcopr
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
constructor {} {{BClass arg arg}} {}
}
} 1 {Constructor of class "AClass" has specified an unknown class, "BClass", in its parent construction specifier.}
Test 2.13 {
# Known but not inherited class in parent constructor
otclInterface AClass {}
otclImplementation AClass {}
otclInterface BClass {
constructor {}
}
otclImplementation BClass {
constructor {} {{AClass asd asd asd}} {}
}
} 1 {Constructor of class "BClass" has specified an unknown class, "AClass", in its parent construction specifier.}
Test 2.14 {
# Duplication of parent constructor calls
otclInterface AClass {}
otclImplementation AClass {}
otclInterface BClass -isA AClass {
constructor {}
}
otclImplementation BClass {
constructor {} {{AClass arg} {AClass arg}} {}
}
} 1 {Duplication of parent construction parameters for class "AClass" from constructor of class "BClass".}
Test 2.15 {
# Private constructor?
otclInterface AClass {}
otclImplementation AClass {
constructor {} {} {}
}
} 1 {Constructor for class "AClass" must be specified in interface.}
Test 2.16 {
# Not enough args for method in implementation
otclInterface AClass {}
otclImplementation AClass {
method
}
} 1 {wrong # args: should be "method name args body"}
Test 2.17 {
# Too many args for method in implementation
otclInterface AClass {}
otclImplementation AClass {
method name args body extra
}
} 1 {wrong # args: should be "method name args body"}
Test 2.18 {
# Implemented as method but interfaced as classMethod
otclInterface AClass {
classMethod methodOne {}
}
otclImplementation AClass {
method methodOne {} {}
}
} 1 {Method "methodOne" specified as a class method in the interfaced but implemented as an instance method.}
Test 2.19 {
# Too few args for classMethod in implementation
otclInterface AClass {}
otclImplementation AClass {
classMethod
}
} 1 {wrong # args: should be "classMethod name args body"}
Test 2.20 {
# Too many args to classMethod in implementation
otclInterface AClass {}
otclImplementation AClass {
classMethod name args body extra
}
} 1 {wrong # args: should be "classMethod name args body"}
Test 2.21 {
# Interfaced as instance and implemented as class method
otclInterface AClass {
method methodOne {}
}
otclImplementation AClass {
classMethod methodOne {} {}
}
} 1 {Method "methodOne" specified as an instance method in the interface but implemented as a class method.}
Test 2.22 {
# Not enough args for attribute
otclInterface AClass {}
otclImplementation AClass {
attribute
}
} 1 {wrong # args: should be "attribute name ?initial?"}
Test 2.22.1 {
# Too many args for attribute
otclInterface AClass {}
otclImplementation AClass {
attribute name initial extra
}
} 1 {wrong # args: should be "attribute name ?initial?"}
Test 2.22.2 {
# Bad name for attribute
otclInterface AClass {}
otclImplementation AClass {
attribute this
}
} 1 {Attribute's cannot be called "this".}
Test 2.23 {
# Duplicated instance attributes
otclInterface AClass {}
otclImplementation AClass {
attribute attOne
attribute attOne
}
} 1 {Instance attribute "attOne" in class "AClass" clashes with another instance attribute of the same name.}
Test 2.24 {
# Duplicated instance with class attribute
otclInterface AClass {}
otclImplementation AClass {
classAttribute attOne 0
attribute attOne
}
} 1 {Instance attribute "attOne" in class "AClass" clashes with a class attribute of the same name.}
Test 2.25 {
# Not enough args for classAttribute
otclInterface AClass {}
otclImplementation AClass {
classAttribute
}
} 1 {wrong # args: should be "classAttribute name initial"}
Test 2.26 {
# Too many args for classAttribute
otclInterface AClass {}
otclImplementation AClass {
classAttribute name initial extra
}
} 1 {wrong # args: should be "classAttribute name initial"}
Test 2.27 {
# Bad name for classAttribute
otclInterface AClass {}
otclImplementation AClass {
classAttribute this 0
}
} 1 {Attribute's cannot be called "this".}
Test 2.28 {
# Duplicated class attribute
otclInterface AClass {}
otclImplementation AClass {
classAttribute attOne 0
classAttribute attOne 1
}
} 1 {Class attribute "attOne" in class "AClass" clashes with another class attribute of the same name.}
Test 2.29 {
# Class attribute classes with instance attribute
otclInterface AClass {}
otclImplementation AClass {
attribute attOne
classAttribute attOne 0
}
} 1 {Class attribute "attOne" in class "AClass" clashes with an instance attribute of the same name.}
Test 2.30 {
# Not enough args for destructor
otclInterface AClass {}
otclImplementation AClass {
destructor
}
} 1 {wrong # args: should be "destructor body"}
Test 2.31 {
# Too many args for destructor
otclInterface AClass {}
otclImplementation AClass {
destructor {body} extra
}
} 1 {wrong # args: should be "destructor body"}
Test 2.32 {
# Body duplicated in implementation
otclInterface AClass {}
otclImplementation AClass {
method a {} {}
method a {} {}
}
} 1 {Method "AClass::a" implementated twice.}
Test 2.33 {
# Body duplicated in implementation
otclInterface AClass {}
otclImplementation AClass {
method a {} {}
classMethod a {} {}
}
} 1 {Method "a" implementated twice.}
Test 2.34 {
# Body duplicated in implementation
otclInterface AClass {}
otclImplementation AClass {
classMethod a {} {}
classMethod a {} {}
}
} 1 {Method "AClass::a" implementated twice.}
Test 2.35 {
# Body duplicated in implementation
otclInterface AClass {}
otclImplementation AClass {
classMethod a {} {}
method a {} {}
}
} 1 {Method "a" implementated twice.}
Test 2.36 {
# Class not completed
otclInterface AClass {
constructor {}
}
otclImplementation AClass {
}
} 1 {Instance method "constructor" of class "AClass" has not been completed. An interfaced method must be implemented.}
Test 2.37 {
# Class not complete
otclInterface AClass {
method A {}
}
otclImplementation AClass {
}
} 1 {Instance method "A" of class "AClass" has not been completed. An interfaced method must be implemented.}
Test 2.38 {
# Class not complete
otclInterface AClass {
classMethod A {}
}
otclImplementation AClass {
}
} 1 {Class method "A" of class "AClass" has not been completed. An interfaced method must be implemented.}
Test 3.1 {
# Class attributes initialisation, read test
otclInterface AClass {
classMethod getValues {}
classMethod modifyValues {}
}
otclImplementation AClass {
classMethod getValues {} {
list $att1 $att2 $att3 $att4 $att5(key1) $att5(key2)