From 3591da4698f377c1c53d8dde7ba877bdf75b9647 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 10 Jun 2014 14:56:48 -0400 Subject: [PATCH] tests: add tests for top-level redefinitions Signed-off-by: Jean Privat --- tests/error_defs2.nit | 21 +++++++++++++++++++++ tests/sav/error_defs2.res | 3 +++ tests/sav/error_defs2_alt1.res | 1 + tests/sav/error_defs2_alt2.res | 1 + tests/sav/error_defs_alt4.res | 2 +- tests/sav/error_defs_alt5.res | 2 +- 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tests/error_defs2.nit create mode 100644 tests/sav/error_defs2.res create mode 100644 tests/sav/error_defs2_alt1.res create mode 100644 tests/sav/error_defs2_alt2.res diff --git a/tests/error_defs2.nit b/tests/error_defs2.nit new file mode 100644 index 0000000..aa28df4 --- /dev/null +++ b/tests/error_defs2.nit @@ -0,0 +1,21 @@ +# This file is part of NIT ( http://www.nitlanguage.org ). +# +# Copyright 2008 Jean Privat +# +# 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. + +import error_defs + +redef fun baz: Int do return 4 +#alt1# redef fun bar: Int do return 40 +#alt2# redef fun foo: Int do return 400 diff --git a/tests/sav/error_defs2.res b/tests/sav/error_defs2.res new file mode 100644 index 0000000..354a0e6 --- /dev/null +++ b/tests/sav/error_defs2.res @@ -0,0 +1,3 @@ +4 +14 +124 diff --git a/tests/sav/error_defs2_alt1.res b/tests/sav/error_defs2_alt1.res new file mode 100644 index 0000000..c79fb13 --- /dev/null +++ b/tests/sav/error_defs2_alt1.res @@ -0,0 +1 @@ +alt/error_defs2_alt1.nit:20,11--13: Error: bar is not a top level method. diff --git a/tests/sav/error_defs2_alt2.res b/tests/sav/error_defs2_alt2.res new file mode 100644 index 0000000..8b01fd5 --- /dev/null +++ b/tests/sav/error_defs2_alt2.res @@ -0,0 +1 @@ +alt/error_defs2_alt2.nit:21,11--13: Error: No property Object::foo is inherited. Remove the redef keyword to define a new property. diff --git a/tests/sav/error_defs_alt4.res b/tests/sav/error_defs_alt4.res index 2e24837..80e2677 100644 --- a/tests/sav/error_defs_alt4.res +++ b/tests/sav/error_defs_alt4.res @@ -1 +1 @@ -alt/error_defs_alt4.nit:29,5--7: Redef error: A::baz is an inherited property. To redefine it, add the redef keyword. +alt/error_defs_alt4.nit:29,5--7: Error: baz is a top level method. diff --git a/tests/sav/error_defs_alt5.res b/tests/sav/error_defs_alt5.res index 7732d68..fec299a 100644 --- a/tests/sav/error_defs_alt5.res +++ b/tests/sav/error_defs_alt5.res @@ -1 +1 @@ -alt/error_defs_alt5.nit:30,14--22: Redef error: error_defs_alt5#A#baz redefines error_defs_alt5#Object#baz with 1 parameter(s), 0 expected. Signature is error_defs_alt5#A#baz: Int +alt/error_defs_alt5.nit:30,11--13: Error: baz is a top level method. -- 1.7.9.5