/* ----------------------------------------------------------------------------- Copyright 2020 Kevin P. Barry Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------------------------------- */ // Author: Kevin P. Barry [ta0kira@gmail.com] testcase "basic error test" { error require compiler "category.+undefined" require compiler "type.+undefined" exclude stderr "." exclude stdout "." } concrete Test { @type execute () -> () } define Test { execute () { \ undefined() } } testcase "basic crash test" { crash Test$execute() require stderr "/testcase:" require stderr "failure message!!!" exclude stdout "failure message!!!" } concrete Test { @type execute () -> () } define Test { execute () { // NOTE: "!!!" is important here because it also tests mixing of escaped and // unescaped characters when handling string literals. fail("failure message!!!") } } testcase "basic success test" { success Test$execute() } concrete Test { @type execute () -> () } define Test { execute () { } } testcase "minimal linking works properly" { success empty } testcase "attempt to define outside of this module" { error require "String" require "module" exclude "procedure definition" } // The declaration for String is in scope, but it lives outside of this module. define String {} testcase "no deadlock with recursive type" { success Test$execute() } concrete Test { @type execute () -> () } concrete Type<#x> { @type call () -> () } define Type { call () {} } define Test { execute () { \ Type>>$call() } } testcase "ModuleOnly is visible to tests" { success Test$execute() } concrete Test { @type execute () -> () } define Test { execute () { optional ModuleOnly value <- empty } }