mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-08-15 14:50:42 +03:00
Fix dictionary and rename readback test
This commit is contained in:
parent
6182ac74fa
commit
137591f7ae
@ -1024,7 +1024,7 @@ impl AsRef<str> for Name {
|
||||
}
|
||||
|
||||
impl Book {
|
||||
pub fn hvmc_entrypoint(&self) -> &str {
|
||||
pub fn hvm_entrypoint(&self) -> &str {
|
||||
match self.entrypoint.as_ref().map(|e| e.as_ref()) {
|
||||
Some("main" | "Main") | None => ENTRY_POINT,
|
||||
Some(nam) => nam,
|
||||
|
@ -27,7 +27,7 @@ pub fn book_to_hvm(book: &Book, diags: &mut Diagnostics) -> Result<(hvm::ast::Bo
|
||||
for rule in def.rules.iter() {
|
||||
let net = term_to_hvm(&rule.body, &mut labels);
|
||||
|
||||
let name = if def.name == *main { book.hvmc_entrypoint().to_string() } else { def.name.0.to_string() };
|
||||
let name = if def.name == *main { book.hvm_entrypoint().to_string() } else { def.name.0.to_string() };
|
||||
|
||||
match net {
|
||||
Ok(net) => {
|
||||
|
@ -65,7 +65,7 @@ pub fn compile_book(
|
||||
}
|
||||
|
||||
if opts.prune {
|
||||
let prune_entrypoints = vec![book.hvmc_entrypoint().to_string()];
|
||||
let prune_entrypoints = vec![book.hvm_entrypoint().to_string()];
|
||||
prune_hvm_book(&mut hvm_book, &prune_entrypoints);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ fn run_lazy() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn readback_lnet() {
|
||||
fn readback_hvm() {
|
||||
run_golden_test_dir(function_name!(), &|code, _| {
|
||||
let mut p = hvm::ast::CoreParser::new(code);
|
||||
let net = p.parse_net()?;
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/compile_file/net_size_too_large.bend
|
||||
---
|
||||
[4m[1m[31mErrors:[0m
|
||||
[1mIn definition '[4mRadix[0m[1m':[0m
|
||||
Definition is too large for hvm (size=120, max size=64). Please break it into smaller pieces.
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: examples/all_tree.bend
|
||||
---
|
||||
Bool/True
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: examples/alloc_small_tree.bend
|
||||
---
|
||||
T
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: examples/example.bend
|
||||
---
|
||||
8
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: examples/neg_fusion.bend
|
||||
---
|
||||
λa λ* a
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/tup_add.bend
|
||||
input_file: tests/golden_tests/readback_hvm/addition.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mDuring readback:[0m
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/bad_net.bend
|
||||
input_file: tests/golden_tests/readback_hvm/bad_net.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mDuring readback:[0m
|
5
tests/snapshots/readback_hvm__bad_net1.bend.snap
Normal file
5
tests/snapshots/readback_hvm__bad_net1.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/bad_net1.bend
|
||||
---
|
||||
λa λb a
|
5
tests/snapshots/readback_hvm__bad_net3.bend.snap
Normal file
5
tests/snapshots/readback_hvm__bad_net3.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/bad_net3.bend
|
||||
---
|
||||
λa λb a
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/complicated_dup.bend
|
||||
input_file: tests/golden_tests/readback_hvm/complicated_dup.bend
|
||||
---
|
||||
λa (λ$b (a ($b $c)) λ$c (a ($b $c)))
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/fst_snd.bend
|
||||
input_file: tests/golden_tests/readback_hvm/fst_snd.bend
|
||||
---
|
||||
(λa a (λb b {{1 3} 2}))
|
5
tests/snapshots/readback_hvm__id.bend.snap
Normal file
5
tests/snapshots/readback_hvm__id.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/id.bend
|
||||
---
|
||||
λa a
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/invalid_op2_op2.bend
|
||||
input_file: tests/golden_tests/readback_hvm/invalid_op2_op2.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mDuring readback:[0m
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/match.bend
|
||||
input_file: tests/golden_tests/readback_hvm/match.bend
|
||||
---
|
||||
switch a = 1 { 0: λb b; _: a-1; }
|
5
tests/snapshots/readback_hvm__nested_let.bend.snap
Normal file
5
tests/snapshots/readback_hvm__nested_let.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/nested_let.bend
|
||||
---
|
||||
3
|
5
tests/snapshots/readback_hvm__nested_tup.bend.snap
Normal file
5
tests/snapshots/readback_hvm__nested_tup.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/nested_tup.bend
|
||||
---
|
||||
{{1 2} {4 {3 5}}}
|
5
tests/snapshots/readback_hvm__number.bend.snap
Normal file
5
tests/snapshots/readback_hvm__number.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/number.bend
|
||||
---
|
||||
10
|
5
tests/snapshots/readback_hvm__simple_tup.bend.snap
Normal file
5
tests/snapshots/readback_hvm__simple_tup.bend.snap
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_hvm/simple_tup.bend
|
||||
---
|
||||
{0 42}
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/addition.bend
|
||||
input_file: tests/golden_tests/readback_hvm/tup_add.bend
|
||||
---
|
||||
[4m[1m[33mWarnings:[0m
|
||||
[1mDuring readback:[0m
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/bad_net1.bend
|
||||
---
|
||||
λa λb a
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/bad_net3.bend
|
||||
---
|
||||
λa λb a
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/id.bend
|
||||
---
|
||||
λa a
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/nested_let.bend
|
||||
---
|
||||
3
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/nested_tup.bend
|
||||
---
|
||||
{{1 2} {4 {3 5}}}
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/number.bend
|
||||
---
|
||||
10
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/readback_lnet/simple_tup.bend
|
||||
---
|
||||
{0 42}
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/run_file/field_vectorization.bend
|
||||
---
|
||||
Bool/T
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
source: tests/golden_tests.rs
|
||||
input_file: tests/golden_tests/run_file/imp_empty_list.bend
|
||||
---
|
||||
λ* λa a
|
Loading…
Reference in New Issue
Block a user