summaryrefslogtreecommitdiff
path: root/tests/files/fail/test_type_number.yaml
diff options
context:
space:
mode:
authorJohan Fleury <jfleury@arcaik.net>2018-10-08 12:58:12 -0400
committerJohan Fleury <jfleury@arcaik.net>2018-10-08 12:58:12 -0400
commit735c78d3ecb695dd16cb37879880f522c4b29c72 (patch)
tree8bfb2ecbd0f03730efa1540cc65d8490b67e8ddd /tests/files/fail/test_type_number.yaml
Import upstream version 1.7.0
Diffstat (limited to 'tests/files/fail/test_type_number.yaml')
-rw-r--r--tests/files/fail/test_type_number.yaml83
1 files changed, 83 insertions, 0 deletions
diff --git a/tests/files/fail/test_type_number.yaml b/tests/files/fail/test_type_number.yaml
new file mode 100644
index 0000000..003b0a6
--- /dev/null
+++ b/tests/files/fail/test_type_number.yaml
@@ -0,0 +1,83 @@
+---
+name: fail-type-number-1
+desc: This tests number validation rule with wrong data types
+data: True
+schema:
+ type: number
+errors:
+ - "Value 'True' is not of type 'number'. Path: ''"
+---
+name: fail-type-number-2
+desc: Test that number type works with as value in map
+data:
+ foo: True
+ bar: 'abc'
+ qwe: []
+ rty: {}
+schema:
+ type: map
+ mapping:
+ foo:
+ type: number
+ bar:
+ type: number
+ qwe:
+ type: number
+ rty:
+ type: number
+errors:
+ - "Value 'True' is not of type 'number'. Path: '/foo'"
+ - "Value '[]' is not of type 'number'. Path: '/qwe'"
+ - "Value 'abc' is not of type 'number'. Path: '/bar'"
+ - "Value '{}' is not of type 'number'. Path: '/rty'"
+---
+name: fail-type-number-3
+desc: Test that different number values works as values in seq
+data:
+ - True
+ - 'abc'
+ - {}
+ - []
+schema:
+ type: seq
+ sequence:
+ - type: number
+errors:
+ - "Value 'True' is not of type 'number'. Path: '/0'"
+ - "Value '[]' is not of type 'number'. Path: '/3'"
+ - "Value 'abc' is not of type 'number'. Path: '/1'"
+ - "Value '{}' is not of type 'number'. Path: '/2'"
+---
+name: fail-type-number-4
+desc: Test that number type works inside nested map, seq, map
+data:
+ foobar:
+ - foo: True
+ bar: 'abc'
+ qwe: {}
+ rty: []
+schema:
+ type: map
+ mapping:
+ foobar:
+ type: seq
+ sequence:
+ - type: map
+ mapping:
+ foo:
+ type: number
+ bar:
+ type: number
+ qwe:
+ type: number
+ rty:
+ type: number
+ ewq:
+ type: number
+ dsa:
+ type: number
+errors:
+ - "Value 'True' is not of type 'number'. Path: '/foobar/0/foo'"
+ - "Value '[]' is not of type 'number'. Path: '/foobar/0/rty'"
+ - "Value 'abc' is not of type 'number'. Path: '/foobar/0/bar'"
+ - "Value '{}' is not of type 'number'. Path: '/foobar/0/qwe'"