Lines
100 %
Functions
Branches
//! Coverage gaps in `compiler/expr.rs` — keyword expressions, lambda
//! literals at value position, quasiquote with various inner shapes,
//! quoted lists in different positions.
use super::common::{compile_and_validate, compile_expect_error};
#[test]
fn keyword_at_value_position() {
compile_and_validate(":my-keyword");
}
fn lambda_literal_at_value_position() {
// Lambda at value position serializes its textual form (via
// `compile_string` of `format_expr(expr)`).
compile_and_validate("(lambda (x) x)");
fn nested_quasiquote_with_unquote() {
compile_and_validate("(defvar x 5) `(a ,x b)");
fn nested_quasiquote_with_unquote_splicing() {
compile_and_validate("(defvar xs '(1 2 3)) `(start ,@xs end)");
fn quasiquote_nested_list() {
compile_and_validate("`(outer (inner ,(+ 1 1)))");
fn quoted_constant_string() {
compile_and_validate("'\"literal\"");
fn quoted_bool() {
compile_and_validate("'#t");
fn quoted_nil() {
compile_and_validate("'nil");
fn quoted_number_fraction() {
compile_and_validate("'(/ 1 4)");
fn quoted_empty_list() {
compile_and_validate("'()");
fn unquote_outside_quasiquote_errors() {
let err = compile_expect_error(",foo");
assert!(
err.contains("unquote") || err.contains("quasiquote"),
"got: {err}"
);
fn empty_function_call_compiles_to_nil() {
// Empty parens parse to an empty list which the compiler treats
// as `nil` (the canonical empty-list representation).
compile_and_validate("()");
fn unbound_symbol_errors() {
let err = compile_expect_error("xyzzy-undefined");
err.contains("Undefined") || err.contains("xyzzy"),
"got: {err}",