diff options
| author | Artyom Pavlov <newpavlov@gmail.com> | 2019-08-17 18:54:56 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-17 18:54:56 +0000 |
| commit | 51dcdcfd94450851d64c6d7c4eeab41c3e61f546 (patch) | |
| tree | 03736fa623009967fb3371d9d51ddc7240037f41 /src/libsyntax/source_map | |
| parent | 7b8273c2e873b814b7c115eabae398d6f11d695b (diff) | |
| parent | d65e272a9fe3e61aa5f229c5358e35a909435575 (diff) | |
| download | rust-51dcdcfd94450851d64c6d7c4eeab41c3e61f546.tar.gz rust-51dcdcfd94450851d64c6d7c4eeab41c3e61f546.zip | |
Merge branch 'master' into redox_builder
Diffstat (limited to 'src/libsyntax/source_map')
| -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); |
