File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
Tests/OneScript.Core.Tests Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ private ICompilerBackend StackInitializer()
5959 }
6060 else
6161 {
62- actualBehavior = ExplicitImportsBehavior . Enabled ;
62+ actualBehavior = ExplicitImportsBehavior . Warn ;
6363 }
6464 }
6565
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ public enum ExplicitImportsBehavior
2323 Warn ,
2424
2525 /// <summary>
26- /// В режиме разработки (при наличии включенного отладчика) обращение к символу без явного импорта вызывает ошибку компиляции .
27- /// Без отладчика ошибки не происходит .
26+ /// В режиме разработки (при наличии включенного отладчика) обращение к символу без явного импорта записывает предупреждение в лог .
27+ /// Без отладчика проверка отключена .
2828 /// </summary>
2929 Development ,
3030
Original file line number Diff line number Diff line change @@ -82,19 +82,26 @@ public void ExplicitImports_Warn_HasWarning()
8282 }
8383
8484 [ Fact ]
85- public void ExplicitImports_Development_WithDebugger_CompilationError ( )
85+ public void ExplicitImports_Development_WithDebugger_HasWarning ( )
8686 {
87+ var debugSessionMock = new Mock < IDebugSession > ( ) ;
88+ debugSessionMock . Setup ( x => x . IsActive ) . Returns ( false ) ;
89+
8790 var debuggerMock = new Mock < IDebugger > ( ) ;
8891 debuggerMock . Setup ( x => x . IsEnabled ) . Returns ( true ) ;
92+ debuggerMock . Setup ( x => x . GetSession ( ) ) . Returns ( debugSessionMock . Object ) ;
8993
90- Action act = ( ) => CompileClientScript (
94+ var code = CompileClientScript (
9195 ExplicitImportsBehavior . Development ,
92- out _ ,
96+ out var shouldCompile ,
9397 debuggerMock . Object ) ;
9498
95- act . Should ( ) . Throw < CompilerException > ( )
96- . WithMessage ( "*" + LibraryModuleName + " принадлежит пакету " + LibraryShortName + "*" ,
97- "в режиме Development с включенным отладчиком должна быть ошибка" ) ;
99+ shouldCompile . Should ( ) . BeTrue ( ) ;
100+ _messages . Should ( ) . HaveCount ( 1 , "должно быть одно предупреждение" )
101+ . And . Contain ( x =>
102+ x . Contains ( LibraryModuleName , StringComparison . InvariantCultureIgnoreCase ) &&
103+ x . Contains ( LibraryShortName , StringComparison . InvariantCultureIgnoreCase ) ,
104+ "в режиме Development с включенным отладчиком должно быть предупреждение" ) ;
98105 }
99106
100107 [ Fact ]
You can’t perform that action at this time.
0 commit comments