candid icon indicating copy to clipboard operation
candid copied to clipboard

revise existing tests to match #311 (subtype checking only for refere…

Open crusso opened this issue 3 years ago • 4 comments

…nce types)

I think these tests are need to change in light of #311 (as verified by Motoko testing)

crusso avatar Mar 18 '22 14:03 crusso

I guess we should implement the new rules in Haskell and Rust to compare notes on these updated tests. (And we means me and Yan respectively)

nomeata avatar Mar 18 '22 14:03 nomeata

The fact that no-one is confident about how this is meant to behave strikes me as slightly worrying ;->

crusso avatar Mar 18 '22 17:03 crusso

Just because it changes every few months doesn’t mean we are not confident? ;-)

nomeata avatar Mar 18 '22 17:03 nomeata

@nomeata thanks for adjusting the tests to use a method name - most of my tests now pass but there's another bug I'll need to figure out on the motoko side (see below).

More pretty printing crap, I'm afraid. Should be possible to sort out (by me).

Output form a private branch (don't try this at home)

[nix-shell:~/clean/motoko]$ candid-tests -p "subtypes" -i ../../candid/test
Parsing construct.test.did ...
Parsing overshoot.test.did ...
Parsing prim.test.did ...
Parsing reference.test.did ...
Parsing subtypes.test.did ...
subtypes:35 null <: null ... ok (pass)
subtypes:37 bool <: bool ... ok (pass)
subtypes:39 nat <: nat ... ok (pass)
subtypes:41 int <: int ... ok (pass)
subtypes:45 nat <: int ... ok (pass)
subtypes:47 int </: nat ... ok (pass)
subtypes:49 nat </: nat8 ... ok (pass)
subtypes:51 nat8 </: nat ... ok (pass)
subtypes:55 nat <: opt bool ... ok (pass)
subtypes:57 opt bool <: opt bool ... ok (pass)
subtypes:59 bool <: opt bool ... ok (pass)
subtypes:61 µ opt <: opt opt nat ... ok (pass)
subtypes:65 record {} <: record {} ... ok (pass)
subtypes:67 record {} <: record { a : opt empty } ... ok (pass)
subtypes:69 record {} <: record { a : opt null } ... ok (pass)
subtypes:71 record {} <: record { a : reserved } ... ok (pass)
subtypes:73 record {} </: record { a : empty } ... ok (pass)
subtypes:75 record {} </: record { a : nat } ... ok (pass)
subtypes:77 record {} </: record { a : null } ... ok (pass)
subtypes:81 func () -> () <: func () -> () ... ok (pass)
subtypes:83 func () -> () <: func () -> (opt empty) ... ok (pass)
subtypes:85 func () -> () <: func () -> (opt null) ... ok (pass)
subtypes:87 func () -> () <: func () -> (reserved) ... ok (pass)
subtypes:89 func () -> () </: func () -> (empty) ... ok (pass)
subtypes:91 func () -> () </: func () -> (nat) ... ok (pass)
subtypes:93 func () -> () </: func () -> (null) ... ok (pass)
subtypes:97 func (opt empty) -> () <: func () -> () ... ok (pass)
subtypes:99 func (opt null) -> () <: func () -> () ... ok (pass)
subtypes:101 func (reserved) -> () <: func () -> () ... ok (pass)
subtypes:103 func (empty) -> () </: func () -> () ... ok (pass)
subtypes:105 func (nat) -> () </: func () -> () ... ok (pass)
subtypes:107 func (null) -> () </: func () -> () ... ok (pass)
subtypes:111 variant {} <: variant {} ... ok (pass)
subtypes:113 variant {} <: variant {0 : nat} ... ok (pass)
subtypes:115 variant {0 : nat} <: variant {0 : nat} ... ok (pass)
subtypes:117 variant {0 : bool} </: variant {0 : nat} ... ok (pass)
subtypes:119 variant {0 : bool} </: variant {1 : bool} ... ok (pass)
subtypes:124 (µ record) <: (µ record) ... not ok (cannot compile)
tmp.mo:5.216-5.231: type error [M0029], unbound type EmptyRecord__38

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async EmptyRecord))) "\44\49\44\4C\02\6A\00\01\01\00\6C\01\00\01\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async EmptyRecord__38 }).m)) : (?(shared () -> async EmptyRecord))))
subtypes:126 (µ record) </: empty ... ok (pass)
subtypes:128 empty <: (µ record) ... not ok (cannot compile)
tmp.mo:5.204-5.219: type error [M0029], unbound type EmptyRecord__41

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async EmptyRecord))) "\44\49\44\4C\01\6A\00\01\6F\00\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async EmptyRecord__41 }).m)) : (?(shared () -> async EmptyRecord))))
subtypes:130 (µ record) <: record {µ record} ... not ok (cannot compile)
tmp.mo:5.231-5.246: type error [M0029], unbound type EmptyRecord__43

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async {_0_ : EmptyRecord}))) "\44\49\44\4C\02\6A\00\01\01\00\6C\01\00\01\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async {_0_ : EmptyRecord__43} }).m)) : (?(shared () -> async {_0_ : EmptyRecord}))))
subtypes:132 record {µ record} <: (µ record) ... not ok (cannot compile)
tmp.mo:5.228-5.243: type error [M0029], unbound type EmptyRecord__45

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async EmptyRecord))) "\44\49\44\4C\03\6A\00\01\01\00\6C\01\00\02\6C\01\00\02\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async EmptyRecord__45 }).m)) : (?(shared () -> async EmptyRecord))))
subtypes:135 (µ variant) <: (µ variant) ... not ok (cannot compile)
tmp.mo:5.217-5.233: type error [M0029], unbound type EmptyVariant__43

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async EmptyVariant))) "\44\49\44\4C\02\6A\00\01\01\00\6B\01\00\01\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async EmptyVariant__43 }).m)) : (?(shared () -> async EmptyVariant))))
subtypes:137 (µ variant) </: empty ... ok (pass)
subtypes:139 empty <: (µ variant) ... not ok (cannot compile)
tmp.mo:5.205-5.221: type error [M0029], unbound type EmptyVariant__46

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async EmptyVariant))) "\44\49\44\4C\01\6A\00\01\6F\00\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async EmptyVariant__46 }).m)) : (?(shared () -> async EmptyVariant))))
subtypes:141 (µ variant) <: variant {µ variant} ... not ok (cannot compile)
tmp.mo:5.234-5.250: type error [M0029], unbound type EmptyVariant__48

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async {#_0_ : EmptyVariant}))) "\44\49\44\4C\02\6A\00\01\01\00\6B\01\00\01\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async {#_0_ : EmptyVariant__48} }).m)) : (?(shared () -> async {#_0_ : EmptyVariant}))))
subtypes:143 variant {µ variant} <: (µ variant) ... not ok (cannot compile)
tmp.mo:5.229-5.245: type error [M0029], unbound type EmptyVariant__50

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async EmptyVariant))) "\44\49\44\4C\03\6A\00\01\01\00\6B\01\00\02\6B\01\00\02\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async EmptyVariant__50 }).m)) : (?(shared () -> async EmptyVariant))))
subtypes:146 (µ vec) <: (µ vec) ... not ok (cannot compile)
tmp.mo:5.202-5.209: type error [M0029], unbound type Vec__48

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async Vec))) "\44\49\44\4C\02\6A\00\01\01\00\6D\01\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async Vec__48 }).m)) : (?(shared () -> async Vec))))
subtypes:148 (µ vec) </: empty ... ok (pass)
subtypes:150 empty <: (µ vec) ... not ok (cannot compile)
tmp.mo:5.196-5.203: type error [M0029], unbound type Vec__51

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async Vec))) "\44\49\44\4C\01\6A\00\01\6F\00\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async Vec__51 }).m)) : (?(shared () -> async Vec))))
subtypes:152 (µ vec) <: vec {µ vec} ... not ok (cannot compile)
tmp.mo:5.205-5.212: type error [M0029], unbound type Vec__53

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async [Vec]))) "\44\49\44\4C\02\6A\00\01\01\00\6D\01\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async [Vec__53] }).m)) : (?(shared () -> async [Vec]))))
subtypes:154 vec {µ vec} <: (µ vec) ... not ok (cannot compile)
tmp.mo:5.208-5.215: type error [M0029], unbound type Vec__55

import Prim "mo:⛔";type EmptyRecord = {_0_ : EmptyRecord};
type EmptyVariant = {#_0_ : EmptyVariant};
type Vec = [Vec];

assert ((prim "deserialize" : Blob -> (?(shared () -> async Vec))) "\44\49\44\4C\03\6A\00\01\01\00\6D\02\6D\02\01\00\01\01\00\01\6D" == (((?(actor "\61\61\61\61\61\2D\61\61" : actor { m : shared () -> async Vec__55 }).m)) : (?(shared () -> async Vec))))
subtypes:161 (future type) <: (opt empty) ... ok (pass)
subtypes:163 (future type) <: (nat) ... ok (pass)
410 tests:  356 skipped  42 ok  12 failed

crusso avatar Apr 09 '22 20:04 crusso