3 use crate::{edition, SessionGlobals}
;
7 let mut i
: Interner
= Interner
::default();
9 assert_eq
!(i
.intern("dog"), Symbol
::new(0));
10 // re-use gets the same entry:
11 assert_eq
!(i
.intern("dog"), Symbol
::new(0));
12 // different string gets a different #:
13 assert_eq
!(i
.intern("cat"), Symbol
::new(1));
14 assert_eq
!(i
.intern("cat"), Symbol
::new(1));
15 // dog is still at zero
16 assert_eq
!(i
.intern("dog"), Symbol
::new(0));
20 fn without_first_quote_test() {
21 SESSION_GLOBALS
.set(&SessionGlobals
::new(edition
::DEFAULT_EDITION
), || {
22 let i
= Ident
::from_str("'break");
23 assert_eq
!(i
.without_first_quote().name
, kw
::Break
);