Rework SESSION_GLOBALS API to prevent overwriting it
This commit is contained in:
parent
0cd0709f19
commit
a2654fb64c
27 changed files with 146 additions and 100 deletions
|
@ -1,9 +1,9 @@
|
|||
use super::*;
|
||||
use rustc_span::with_default_session_globals;
|
||||
use rustc_span::create_default_session_globals_then;
|
||||
|
||||
#[test]
|
||||
fn test_block_doc_comment_1() {
|
||||
with_default_session_globals(|| {
|
||||
create_default_session_globals_then(|| {
|
||||
let comment = "\n * Test \n ** Test\n * Test\n";
|
||||
let stripped = beautify_doc_string(Symbol::intern(comment));
|
||||
assert_eq!(stripped.as_str(), " Test \n* Test\n Test");
|
||||
|
@ -12,7 +12,7 @@ fn test_block_doc_comment_1() {
|
|||
|
||||
#[test]
|
||||
fn test_block_doc_comment_2() {
|
||||
with_default_session_globals(|| {
|
||||
create_default_session_globals_then(|| {
|
||||
let comment = "\n * Test\n * Test\n";
|
||||
let stripped = beautify_doc_string(Symbol::intern(comment));
|
||||
assert_eq!(stripped.as_str(), " Test\n Test");
|
||||
|
@ -21,7 +21,7 @@ fn test_block_doc_comment_2() {
|
|||
|
||||
#[test]
|
||||
fn test_block_doc_comment_3() {
|
||||
with_default_session_globals(|| {
|
||||
create_default_session_globals_then(|| {
|
||||
let comment = "\n let a: *i32;\n *a = 5;\n";
|
||||
let stripped = beautify_doc_string(Symbol::intern(comment));
|
||||
assert_eq!(stripped.as_str(), " let a: *i32;\n *a = 5;");
|
||||
|
@ -30,7 +30,7 @@ fn test_block_doc_comment_3() {
|
|||
|
||||
#[test]
|
||||
fn test_line_doc_comment() {
|
||||
with_default_session_globals(|| {
|
||||
create_default_session_globals_then(|| {
|
||||
let stripped = beautify_doc_string(Symbol::intern(" test"));
|
||||
assert_eq!(stripped.as_str(), " test");
|
||||
let stripped = beautify_doc_string(Symbol::intern("! test"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue