From 04be023f8bc114edb6dddae6cee3bd58ea758561 Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Fri, 11 May 2018 22:02:48 +0300 Subject: [PATCH] Get 100% code coverage --- lib/App/Scheme79asm.pm | 6 +++--- t/Compiler.t | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/App/Scheme79asm.pm b/lib/App/Scheme79asm.pm index 6a2b485..374a8a3 100644 --- a/lib/App/Scheme79asm.pm +++ b/lib/App/Scheme79asm.pm @@ -121,9 +121,9 @@ sub print_binary16 { die "addr_bits + type_bits >= 16\n"if $self->{addr_bits} + $self->{type_bits} > 16; my $length = @{$self->{memory}}; - print $fh pack 'n', $length or croak "Failed to print memory size: $!"; + print $fh pack 'n', $length or croak "Failed to print memory size: $!"; # uncoverable branch true for (@{$self->{memory}}) { - print $fh pack 'n', $_ or croak "Failed to print memory: $!" + print $fh pack 'n', $_ or croak "Failed to print memory: $!" # uncoverable branch true } } @@ -147,7 +147,7 @@ sub print_verilog { my $string = "mem[$index] <= $val;"; $string .= "$spaces // $comment" if defined $comment; - say $fh $string or croak "Failed to print verilog: $!"; + say $fh $string or croak "Failed to print verilog: $!"; # uncoverable branch true } } diff --git a/t/Compiler.t b/t/Compiler.t index 847cdb2..e50107a 100644 --- a/t/Compiler.t +++ b/t/Compiler.t @@ -3,7 +3,7 @@ use strict; use warnings; use Data::Dump::Sexp; -use Test::More tests => 31; +use Test::More tests => 32; BEGIN { use_ok('App::Scheme79asm::Compiler') }; @@ -28,6 +28,7 @@ sub is_toplevel { } is_sexp new->process_quoted(to_sexp '5'), '(SYMBOL 3)', 'process_quoted 5'; +is_sexp new->process_quoted(to_sexp 'NIL'), '(LIST 0)', 'process_quoted NIL'; is_sexp new->process_quoted(to_sexp '()'), '(LIST 0)', 'process_quoted ()'; is_sexp new->process_quoted(to_sexp '(5 foo)'), '(LIST (LIST (LIST 0) (SYMBOL 3)) (SYMBOL 4))', 'process_quoted (5 foo)'; is_sexp new->process_quoted(to_sexp '(((5)))'), '(LIST (LIST 0) (LIST (LIST 0) (LIST (LIST 0) (SYMBOL 3))))', 'process_quoted (((5)))'; -- 2.39.2