@@ -15,22 +15,18 @@ fn test_format_title() {
1515 slices : vec ! [ ] ,
1616 } ;
1717 let output = dl:: DisplayList {
18- body : vec ! [
19- dl:: DisplayLine :: Raw ( dl:: DisplayRawLine :: Annotation {
20- annotation: dl:: Annotation {
21- annotation_type: dl:: DisplayAnnotationType :: Error ,
22- id: Some ( "E0001" . to_string( ) ) ,
23- label: vec![
24- dl:: DisplayTextFragment {
25- content: "This is a title" . to_string( ) ,
26- style: dl:: DisplayTextStyle :: Emphasis ,
27- } ,
28- ] ,
29- } ,
30- source_aligned: false ,
31- continuation: false ,
32- } ) ,
33- ] ,
18+ body : vec ! [ dl:: DisplayLine :: Raw ( dl:: DisplayRawLine :: Annotation {
19+ annotation: dl:: Annotation {
20+ annotation_type: dl:: DisplayAnnotationType :: Error ,
21+ id: Some ( "E0001" . to_string( ) ) ,
22+ label: vec![ dl:: DisplayTextFragment {
23+ content: "This is a title" . to_string( ) ,
24+ style: dl:: DisplayTextStyle :: Emphasis ,
25+ } ] ,
26+ } ,
27+ source_aligned: false ,
28+ continuation: false ,
29+ } ) ] ,
3430 } ;
3531 assert_eq ! ( dl:: DisplayList :: from( input) , output) ;
3632}
@@ -40,15 +36,13 @@ fn test_format_slice() {
4036 let input = snippet:: Snippet {
4137 title : None ,
4238 footer : vec ! [ ] ,
43- slices : vec ! [
44- snippet:: Slice {
45- source: "This is line 1\n This is line 2" . to_string( ) ,
46- line_start: 5402 ,
47- origin: None ,
48- annotations: vec![ ] ,
49- fold: false ,
50- } ,
51- ] ,
39+ slices : vec ! [ snippet:: Slice {
40+ source: "This is line 1\n This is line 2" . to_string( ) ,
41+ line_start: 5402 ,
42+ origin: None ,
43+ annotations: vec![ ] ,
44+ fold: false ,
45+ } ] ,
5246 } ;
5347 let output = dl:: DisplayList {
5448 body : vec ! [
@@ -163,21 +157,17 @@ fn test_format_slice_annotation_standalone() {
163157 let input = snippet:: Snippet {
164158 title : None ,
165159 footer : vec ! [ ] ,
166- slices : vec ! [
167- snippet:: Slice {
168- source: "This is line 1\n This is line 2" . to_string( ) ,
169- line_start: 5402 ,
170- origin: None ,
171- annotations: vec![
172- snippet:: SourceAnnotation {
173- range: ( 22 , 24 ) ,
174- label: "Test annotation" . to_string( ) ,
175- annotation_type: snippet:: AnnotationType :: Info ,
176- } ,
177- ] ,
178- fold: false ,
179- } ,
180- ] ,
160+ slices : vec ! [ snippet:: Slice {
161+ source: "This is line 1\n This is line 2" . to_string( ) ,
162+ line_start: 5402 ,
163+ origin: None ,
164+ annotations: vec![ snippet:: SourceAnnotation {
165+ range: ( 22 , 24 ) ,
166+ label: "Test annotation" . to_string( ) ,
167+ annotation_type: snippet:: AnnotationType :: Info ,
168+ } ] ,
169+ fold: false ,
170+ } ] ,
181171 } ;
182172 let output = dl:: DisplayList {
183173 body : vec ! [
@@ -209,12 +199,10 @@ fn test_format_slice_annotation_standalone() {
209199 annotation: dl:: Annotation {
210200 annotation_type: dl:: DisplayAnnotationType :: Info ,
211201 id: None ,
212- label: vec![
213- dl:: DisplayTextFragment {
214- content: "Test annotation" . to_string( ) ,
215- style: dl:: DisplayTextStyle :: Regular ,
216- } ,
217- ] ,
202+ label: vec![ dl:: DisplayTextFragment {
203+ content: "Test annotation" . to_string( ) ,
204+ style: dl:: DisplayTextStyle :: Regular ,
205+ } ] ,
218206 } ,
219207 range: ( 6 , 8 ) ,
220208 annotation_type: dl:: DisplayAnnotationType :: Info ,
@@ -235,40 +223,36 @@ fn test_format_slice_annotation_standalone() {
235223fn test_format_label ( ) {
236224 let input = snippet:: Snippet {
237225 title : None ,
238- footer : vec ! [
239- snippet:: Annotation {
240- id: None ,
241- label: Some ( "This __is__ a title" . to_string( ) ) ,
242- annotation_type: snippet:: AnnotationType :: Error ,
243- } ,
244- ] ,
226+ footer : vec ! [ snippet:: Annotation {
227+ id: None ,
228+ label: Some ( "This __is__ a title" . to_string( ) ) ,
229+ annotation_type: snippet:: AnnotationType :: Error ,
230+ } ] ,
245231 slices : vec ! [ ] ,
246232 } ;
247233 let output = dl:: DisplayList {
248- body : vec ! [
249- dl:: DisplayLine :: Raw ( dl:: DisplayRawLine :: Annotation {
250- annotation: dl:: Annotation {
251- annotation_type: dl:: DisplayAnnotationType :: Error ,
252- id: None ,
253- label: vec![
254- dl:: DisplayTextFragment {
255- content: "This " . to_string( ) ,
256- style: dl:: DisplayTextStyle :: Regular ,
257- } ,
258- dl:: DisplayTextFragment {
259- content: "is" . to_string( ) ,
260- style: dl:: DisplayTextStyle :: Emphasis ,
261- } ,
262- dl:: DisplayTextFragment {
263- content: " a title" . to_string( ) ,
264- style: dl:: DisplayTextStyle :: Regular ,
265- } ,
266- ] ,
267- } ,
268- source_aligned: true ,
269- continuation: false ,
270- } ) ,
271- ] ,
234+ body : vec ! [ dl:: DisplayLine :: Raw ( dl:: DisplayRawLine :: Annotation {
235+ annotation: dl:: Annotation {
236+ annotation_type: dl:: DisplayAnnotationType :: Error ,
237+ id: None ,
238+ label: vec![
239+ dl:: DisplayTextFragment {
240+ content: "This " . to_string( ) ,
241+ style: dl:: DisplayTextStyle :: Regular ,
242+ } ,
243+ dl:: DisplayTextFragment {
244+ content: "is" . to_string( ) ,
245+ style: dl:: DisplayTextStyle :: Emphasis ,
246+ } ,
247+ dl:: DisplayTextFragment {
248+ content: " a title" . to_string( ) ,
249+ style: dl:: DisplayTextStyle :: Regular ,
250+ } ,
251+ ] ,
252+ } ,
253+ source_aligned: true ,
254+ continuation: false ,
255+ } ) ] ,
272256 } ;
273257 assert_eq ! ( dl:: DisplayList :: from( input) , output) ;
274258}
0 commit comments