File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -440,7 +440,9 @@ impl From<LegacyOptions> for StringOptions {
440
440
impl LegacyOptions {
441
441
pub ( crate ) fn adjust_options ( mut self ) -> Self {
442
442
if let Some ( file) = & self . file {
443
- if self . indented_syntax . is_some ( ) || self . importers . is_some ( ) {
443
+ if self . data . is_none ( )
444
+ && ( self . indented_syntax . is_some ( ) || self . importers . is_some ( ) )
445
+ {
444
446
self . data = Some ( fs:: read_to_string ( file) . unwrap ( ) ) ;
445
447
self . indented_syntax = Some ( self . indented_syntax . unwrap_or_default ( ) ) ;
446
448
}
Original file line number Diff line number Diff line change @@ -500,6 +500,22 @@ mod compile_string {
500
500
assert_eq ! ( err. span( ) . unwrap( ) . start. line, 0 ) ;
501
501
assert_eq ! ( err. span( ) . unwrap( ) . url. as_ref( ) . unwrap( ) , & url) ;
502
502
}
503
+
504
+ #[ test]
505
+ fn with_multi_span_errors ( ) {
506
+ let sandbox = Sandbox :: default ( ) ;
507
+ let url = sandbox. path ( ) . join ( "foo.scss" ) . to_url ( ) ;
508
+
509
+ let mut sass = Sass :: new ( exe_path ( ) ) . unwrap ( ) ;
510
+ let err = sass
511
+ . compile_string (
512
+ "@use \" sass:math\" ; @use \" sass:math\" " ,
513
+ StringOptionsBuilder :: default ( ) . url ( url. clone ( ) ) . build ( ) ,
514
+ )
515
+ . unwrap_err ( ) ;
516
+ assert_eq ! ( err. span( ) . unwrap( ) . start. line, 0 ) ;
517
+ assert_eq ! ( err. span( ) . unwrap( ) . url. as_ref( ) . unwrap( ) , & url) ;
518
+ }
503
519
}
504
520
}
505
521
}
You can’t perform that action at this time.
0 commit comments