From ca969d616f881a4efb6073a2b9cefb45dabc3575 Mon Sep 17 00:00:00 2001 From: Arka Poddar Date: Mon, 7 Aug 2023 00:01:54 +0530 Subject: [PATCH] Added examples (#3141) * Added examples * Ram cargo fmt * Changed as per Lint suggested --- boa_interner/src/tests.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/boa_interner/src/tests.rs b/boa_interner/src/tests.rs index 3e5b46f733..3a79668da3 100644 --- a/boa_interner/src/tests.rs +++ b/boa_interner/src/tests.rs @@ -112,3 +112,21 @@ fn check_unpaired_surrogates() { assert_eq!(interner.resolve_expect(sym6).utf8(), Some("jkl")); assert_eq!(interner.resolve_expect(sym6).utf16(), utf16!("jkl")); } + +#[test] +fn check_empty_interner() { + let interner = Interner::default(); + + let sym = sym_from_usize(123); // Choose an arbitrary symbol + + assert!(interner.resolve(sym).is_none()); +} + +#[test] +fn check_capacity() { + let interner = Interner::with_capacity(100); + + let sym = sym_from_usize(123); // Choose an arbitrary symbol + + assert!(interner.resolve(sym).is_none()); +}