aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/s-expressions/suites/Casts/StrictCastOverNull.yql
blob: d7c66842b07aa780dfcabec1db894aec6eacd935 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
(

(let config (DataSource 'config))
(let world (Configure! world config 'PureDataSource 'yt))
(let res_sink (DataSink 'result))

# Null -> Uint16?
(let cast (StrictCast (Null) (OptionalType (DataType 'Uint16))))
(let world (Write! world res_sink (Key) cast '('('type))))

# Just(Null) -> Null? [good]
(let cast (StrictCast (Just (Null)) (NullType)))
(let world (Write! world res_sink (Key) cast '('('type))))

# Nothing(Null?) -> Null? [fail]
(let cast (StrictCast (Nothing (OptionalType (NullType))) (NullType)))
(let world (Write! world res_sink (Key) cast '('('type))))

# Nothing(Uint16?) -> Null
(let cast (StrictCast (Nothing (OptionalType (DataType 'Uint16))) (NullType)))
(let world (Write! world res_sink (Key) cast '('('type))))

# Null -> Null?
(let cast (StrictCast (Null) (OptionalType (NullType))))
(let world (Write! world res_sink (Key) cast '('('type))))

(let world (Commit! world res_sink))
(return world)

)