Hide Dict.hashTestOnly

This commit is contained in:
satotake 2021-11-07 12:30:04 +00:00 committed by GitHub
parent f3ee0bef40
commit a12b75192e
3 changed files with 18 additions and 19 deletions

View file

@ -1080,9 +1080,7 @@ define_builtins! {
7 DICT_INSERT: "insert"
8 DICT_LEN: "len"
// This should not be exposed to users, its for testing the
// hash function ONLY
9 DICT_TEST_HASH: "hashTestOnly"
9 DICT_TEST_HASH: "#hashTestOnly" // for testing the hash function ONLY
10 DICT_REMOVE: "remove"
11 DICT_CONTAINS: "contains"

View file

@ -20,7 +20,7 @@ roc_mono = { path = "../mono" }
roc_reporting = { path = "../reporting" }
roc_load = { path = "../load" }
roc_can = { path = "../can" }
roc_parse = { path = "../parse" }
roc_parse = { path = "../parse" , features = []}
roc_build = { path = "../build" }
roc_std = { path = "../../roc_std" }
roc_gen_wasm = { path = "../gen_wasm" }
@ -43,6 +43,7 @@ quickcheck = "0.8"
quickcheck_macros = "0.8"
tokio = { version = "0.2", features = ["blocking", "fs", "sync", "rt-threaded"] }
bumpalo = { version = "3.6.1", features = ["collections"] }
roc_parse = { path = "../parse" , features = ["keep_shadowed_builtins"]}
[features]
default = []

View file

@ -9,7 +9,7 @@ fn basic_hash() {
assert_evals_to!(
indoc!(
r#"
Dict.hashTestOnly 0 0
Dict.#hashTestOnly 0 0
"#
),
9718519427346233646,
@ -19,15 +19,15 @@ fn basic_hash() {
#[test]
fn hash_str_with_seed() {
assert_evals_to!("Dict.hashTestOnly 1 \"a\"", 0xbed235177f41d328, u64);
assert_evals_to!("Dict.hashTestOnly 2 \"abc\"", 0xbe348debe59b27c3, u64);
assert_evals_to!("Dict.#hashTestOnly 1 \"a\"", 0xbed235177f41d328, u64);
assert_evals_to!("Dict.#hashTestOnly 2 \"abc\"", 0xbe348debe59b27c3, u64);
}
#[test]
fn hash_record() {
assert_evals_to!("Dict.hashTestOnly 1 { x: \"a\" } ", 0xbed235177f41d328, u64);
assert_evals_to!("Dict.#hashTestOnly 1 { x: \"a\" } ", 0xbed235177f41d328, u64);
assert_evals_to!(
"Dict.hashTestOnly 1 { x: 42, y: 3.14 } ",
"Dict.#hashTestOnly 1 { x: 42, y: 3.14 } ",
5348189196103430707,
u64
);
@ -36,7 +36,7 @@ fn hash_record() {
#[test]
fn hash_result() {
assert_evals_to!(
"Dict.hashTestOnly 0 (List.get [ 0x1 ] 0) ",
"Dict.#hashTestOnly 0 (List.get [ 0x1 ] 0) ",
2878521786781103245,
u64
);
@ -52,7 +52,7 @@ fn hash_linked_list() {
input : LinkedList I64
input = Nil
Dict.hashTestOnly 0 input
Dict.#hashTestOnly 0 input
"#
),
0,
@ -67,7 +67,7 @@ fn hash_linked_list() {
input : LinkedList I64
input = Cons 4 (Cons 3 Nil)
Dict.hashTestOnly 0 input
Dict.#hashTestOnly 0 input
"#
),
8287696503006938486,
@ -88,7 +88,7 @@ fn hash_expr() {
add : Expr
add = Add x x
Dict.hashTestOnly 0 add
Dict.#hashTestOnly 0 add
"#
),
10825806964604997723,
@ -109,7 +109,7 @@ fn hash_nullable_expr() {
add : Expr
add = Add x x
Dict.hashTestOnly 0 add
Dict.#hashTestOnly 0 add
"#
),
1907558799788307114,
@ -127,7 +127,7 @@ fn hash_rosetree() {
x : Rose I64
x = Rose []
Dict.hashTestOnly 0 x
Dict.#hashTestOnly 0 x
"#
),
0,
@ -148,7 +148,7 @@ fn hash_union_same_content() {
b : Foo
b = B 42
{ a: Dict.hashTestOnly 0 a, b : Dict.hashTestOnly 0 b }
{ a: Dict.#hashTestOnly 0 a, b : Dict.#hashTestOnly 0 b }
"#
),
true,
@ -170,7 +170,7 @@ fn hash_recursive_union_same_content() {
v2 : Expr
v2 = Val2 42
{ a: Dict.hashTestOnly 0 v1, b : Dict.hashTestOnly 0 v2 }
{ a: Dict.#hashTestOnly 0 v1, b : Dict.#hashTestOnly 0 v2 }
"#
),
true,
@ -192,7 +192,7 @@ fn hash_nullable_recursive_union_same_content() {
v2 : Expr
v2 = Val2 42
{ a: Dict.hashTestOnly 0 v1, b : Dict.hashTestOnly 0 v2 }
{ a: Dict.#hashTestOnly 0 v1, b : Dict.#hashTestOnly 0 v2 }
"#
),
true,
@ -209,7 +209,7 @@ fn hash_list() {
x : List Str
x = [ "foo", "bar", "baz" ]
Dict.hashTestOnly 0 x
Dict.#hashTestOnly 0 x
"#
),
10731521034618280801,