tests: test advice for useless repeated type in redef
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 25 May 2015 15:30:56 +0000 (11:30 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 28 May 2015 13:54:10 +0000 (09:54 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

tests/nitpick.args [new file with mode: 0644]
tests/sav/nitpick_args1.res [new file with mode: 0644]
tests/test_advice_repeated_types.nit [new file with mode: 0644]

diff --git a/tests/nitpick.args b/tests/nitpick.args
new file mode 100644 (file)
index 0000000..3ae7a2a
--- /dev/null
@@ -0,0 +1 @@
+--no-color -W test_advice_repeated_types.nit
diff --git a/tests/sav/nitpick_args1.res b/tests/sav/nitpick_args1.res
new file mode 100644 (file)
index 0000000..c48ab7e
--- /dev/null
@@ -0,0 +1,10 @@
+../lib/standard/bytes.nit:51,7--19: Documentation warning: Undocumented property `with_capacity`
+../lib/standard/bytes.nit:164,6--13: Documentation warning: Undocumented property `to_bytes`
+test_advice_repeated_types.nit:36,15--20: Warning: useless type repetition on redefined attribute `_a`
+test_advice_repeated_types.nit:37,18--20: Warning: useless type repetition on parameter `b1` for redefined method `b`
+test_advice_repeated_types.nit:38,18--20: Warning: useless type repetition on parameter `c1` for redefined method `c`
+test_advice_repeated_types.nit:38,27--29: Warning: useless type repetition on parameter `c2` for redefined method `c`
+test_advice_repeated_types.nit:39,15--20: Warning: useless return type repetition for redefined method `d`
+test_advice_repeated_types.nit:40,18--20: Warning: useless type repetition on parameter `e1` for redefined method `e`
+test_advice_repeated_types.nit:40,24--29: Warning: useless return type repetition for redefined method `e`
+test_advice_repeated_types.nit:49,18--20: Warning: useless type repetition on parameter `e1` for redefined method `e`
diff --git a/tests/test_advice_repeated_types.nit b/tests/test_advice_repeated_types.nit
new file mode 100644 (file)
index 0000000..21f1a04
--- /dev/null
@@ -0,0 +1,56 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# 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.
+
+class A
+       var a: Object
+       fun b(b1: Int) is abstract
+       fun c(c1: Int, c2: Int) is abstract
+       fun d: Object is abstract
+       fun e(e1: Int): Object is abstract
+end
+
+class B
+       super A
+
+       redef var a
+       redef fun b(b1) do end
+       redef fun c(c1, c2) do end
+       redef fun d do return ""
+       redef fun e(e1) do return ""
+end
+
+class C
+       super A
+
+       redef var a: Object
+       redef fun b(b1: Int) do end
+       redef fun c(c1: Int, c2: Int) do end
+       redef fun d: Object do return ""
+       redef fun e(e1: Int): Object do return ""
+end
+
+class D
+       super A
+
+       redef fun b(b1) do end
+       redef fun c(c1, c2) do end
+       redef fun d: Int do return 1
+       redef fun e(e1: Int): Numeric do return 1
+end
+
+class E
+       super A
+
+       redef var d: Int = 1
+end