diff options
| author | Baoshan <pangbw@gmail.com> | 2019-08-29 09:29:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-29 09:29:23 -0700 |
| commit | 043c19c69c0beac3696cb82d44476ba4298a6b07 (patch) | |
| tree | 1813e5dd1e4efd5806f401968b4ed34b8c9c76ac /src/libsyntax/source_map/tests.rs | |
| parent | cae6d66d9989857e321e0963142b08b1517dc723 (diff) | |
| parent | 76f17219c71973fd4a58f2f8020eec4d8f5dcd11 (diff) | |
| download | rust-043c19c69c0beac3696cb82d44476ba4298a6b07.tar.gz rust-043c19c69c0beac3696cb82d44476ba4298a6b07.zip | |
Merge branch 'master' into bpang-runtest
Diffstat (limited to 'src/libsyntax/source_map/tests.rs')
| -rw-r--r-- | src/libsyntax/source_map/tests.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libsyntax/source_map/tests.rs b/src/libsyntax/source_map/tests.rs index 427e86b56e1..c7b8332c53e 100644 --- a/src/libsyntax/source_map/tests.rs +++ b/src/libsyntax/source_map/tests.rs @@ -91,7 +91,7 @@ fn t6() { fn t7() { // Test span_to_lines for a span ending at the end of source_file let sm = init_source_map(); - let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION); + let span = Span::with_root_ctxt(BytePos(12), BytePos(23)); let file_lines = sm.span_to_lines(span).unwrap(); assert_eq!(file_lines.file.name, PathBuf::from("blork.rs").into()); @@ -107,7 +107,7 @@ fn span_from_selection(input: &str, selection: &str) -> Span { assert_eq!(input.len(), selection.len()); let left_index = selection.find('~').unwrap() as u32; let right_index = selection.rfind('~').map(|x|x as u32).unwrap_or(left_index); - Span::new(BytePos(left_index), BytePos(right_index + 1), NO_EXPANSION) + Span::with_root_ctxt(BytePos(left_index), BytePos(right_index + 1)) } /// Tests span_to_snippet and span_to_lines for a span converting 3 @@ -137,7 +137,7 @@ fn span_to_snippet_and_lines_spanning_multiple_lines() { fn t8() { // Test span_to_snippet for a span ending at the end of source_file let sm = init_source_map(); - let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION); + let span = Span::with_root_ctxt(BytePos(12), BytePos(23)); let snippet = sm.span_to_snippet(span); assert_eq!(snippet, Ok("second line".to_string())); @@ -147,7 +147,7 @@ fn t8() { fn t9() { // Test span_to_str for a span ending at the end of source_file let sm = init_source_map(); - let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION); + let span = Span::with_root_ctxt(BytePos(12), BytePos(23)); let sstr = sm.span_to_string(span); assert_eq!(sstr, "blork.rs:2:1: 2:12"); @@ -198,10 +198,9 @@ impl SourceMapExtension for SourceMap { let lo = hi + offset; hi = lo + substring.len(); if i == n { - let span = Span::new( + let span = Span::with_root_ctxt( BytePos(lo as u32 + file.start_pos.0), BytePos(hi as u32 + file.start_pos.0), - NO_EXPANSION, ); assert_eq!(&self.span_to_snippet(span).unwrap()[..], substring); |
