aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/vlib/v/checker/tests/deprecations.vv
diff options
context:
space:
mode:
Diffstat (limited to 'v_windows/v/vlib/v/checker/tests/deprecations.vv')
-rw-r--r--v_windows/v/vlib/v/checker/tests/deprecations.vv70
1 files changed, 70 insertions, 0 deletions
diff --git a/v_windows/v/vlib/v/checker/tests/deprecations.vv b/v_windows/v/vlib/v/checker/tests/deprecations.vv
new file mode 100644
index 0000000..a0a2b8f
--- /dev/null
+++ b/v_windows/v/vlib/v/checker/tests/deprecations.vv
@@ -0,0 +1,70 @@
+// methods using [deprecated_after]:
+struct Abc {
+ x int
+}
+
+fn (a Abc) str() string {
+ return 'Abc { x: $a.x }'
+}
+
+[deprecated: 'custom message 1']
+[deprecated_after: '3000-11-01']
+fn (a Abc) future() {
+ dump(@METHOD)
+ dump(a)
+}
+
+[deprecated: 'custom message 2']
+[deprecated_after: '2021-03-01']
+fn (a Abc) past() {
+ dump(@METHOD)
+ dump(a)
+}
+
+[deprecated: 'custom message 3']
+fn (a Abc) simply_deprecated() {
+ dump(@METHOD)
+ dump(a)
+}
+
+// functions using [deprecated_after]:
+[deprecated: 'custom message 4']
+[deprecated_after: '3000-12-30']
+fn future() {
+ dump(@FN)
+}
+
+[deprecated: 'custom message 5']
+[deprecated_after: '2021-03-01']
+fn past() {
+ dump(@FN)
+}
+
+[deprecated: 'custom message 6']
+[deprecated_after: '1990-03-01']
+fn ancient() {
+ dump(@FN)
+}
+
+[deprecated: 'custom message 7']
+fn simply_deprecated() {
+ dump(@FN)
+}
+
+[deprecated]
+fn just_deprecated() {
+ dump(@FN)
+}
+
+fn main() {
+ future()
+ past()
+ simply_deprecated()
+ just_deprecated()
+ ancient()
+ //
+ a := Abc{}
+ a.future()
+ a.past()
+ a.simply_deprecated()
+}