@@ -174,10 +174,32 @@ Assert.test("preconditionFailure")
174174 preconditionFailure ( " this should fail " )
175175}
176176
177+ Assert . test ( " _precondition " )
178+ . xfail ( . custom(
179+ { _isFastAssertConfiguration ( ) } ,
180+ reason: " preconditions are disabled in Unchecked mode " ) )
181+ . crashOutputMatches ( _isDebugAssertConfiguration ( ) ? " this should fail " : " " )
182+ . code {
183+ var x = 2
184+ _precondition ( x * 21 == 42 , " should not fail " )
185+ expectCrashLater ( )
186+ _precondition ( x == 42 , " this should fail " )
187+ }
188+
189+ Assert . test ( " _preconditionFailure " )
190+ . skip ( . custom(
191+ { _isFastAssertConfiguration ( ) } ,
192+ reason: " optimizer assumes that the code path is unreachable " ) )
193+ . crashOutputMatches ( _isDebugAssertConfiguration ( ) ? " this should fail " : " " )
194+ . code {
195+ expectCrashLater ( )
196+ _preconditionFailure ( " this should fail " )
197+ }
198+
177199Assert . test ( " _debugPrecondition " )
178200 . xfail ( . custom(
179- { !_isDebugAssertConfiguration ( ) } ,
180- reason: " debug preconditions are disabled in Release and Unchecked mode " ) )
201+ { !_isStdlibDebugChecksEnabled ( ) } ,
202+ reason: " debug preconditions are disabled " ) )
181203 . crashOutputMatches ( _isDebugAssertConfiguration ( ) ? " this should fail " : " " )
182204 . code {
183205 var x = 2
@@ -188,9 +210,9 @@ Assert.test("_debugPrecondition")
188210
189211Assert . test ( " _debugPreconditionFailure " )
190212 . skip ( . custom(
191- { !_isDebugAssertConfiguration ( ) } ,
213+ { !_isStdlibDebugChecksEnabled ( ) } ,
192214 reason: " optimizer assumes that the code path is unreachable " ) )
193- . crashOutputMatches ( " this should fail " )
215+ . crashOutputMatches ( _isDebugAssertConfiguration ( ) ? " this should fail " : " " )
194216 . code {
195217 expectCrashLater ( )
196218 _debugPreconditionFailure ( " this should fail " )
0 commit comments