Skip to content

Commit

Permalink
add test for checking exception
Browse files Browse the repository at this point in the history
  • Loading branch information
kosyloa committed Dec 1, 2023
1 parent 898b448 commit 39db17c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DXFeedFramework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
648BD56D2AC56A04004A3A95 /* SubscriptionUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648BD56C2AC56A04004A3A95 /* SubscriptionUtils.swift */; };
648BD56F2AC582AB004A3A95 /* DateTimeParserTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648BD56E2AC582AB004A3A95 /* DateTimeParserTest.swift */; };
648C72472B18ABFC00E2FEF3 /* DXConnectionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648C72462B18ABFC00E2FEF3 /* DXConnectionTest.swift */; };
648C72492B19CA5A00E2FEF3 /* DXExceptionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648C72482B19CA5A00E2FEF3 /* DXExceptionTest.swift */; };
648E98AA2AAF625800BFD219 /* IIndexedEvent+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648E98A92AAF625800BFD219 /* IIndexedEvent+Ext.swift */; };
649282E72AD54919008F0F04 /* ScheduleUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649282E62AD54919008F0F04 /* ScheduleUtils.swift */; };
649282E82AD54919008F0F04 /* ScheduleUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649282E62AD54919008F0F04 /* ScheduleUtils.swift */; };
Expand Down Expand Up @@ -688,6 +689,7 @@
648BD56C2AC56A04004A3A95 /* SubscriptionUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionUtils.swift; sourceTree = "<group>"; };
648BD56E2AC582AB004A3A95 /* DateTimeParserTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeParserTest.swift; sourceTree = "<group>"; };
648C72462B18ABFC00E2FEF3 /* DXConnectionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXConnectionTest.swift; sourceTree = "<group>"; };
648C72482B19CA5A00E2FEF3 /* DXExceptionTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DXExceptionTest.swift; sourceTree = "<group>"; };
648E98A92AAF625800BFD219 /* IIndexedEvent+Ext.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "IIndexedEvent+Ext.swift"; sourceTree = "<group>"; };
649282E62AD54919008F0F04 /* ScheduleUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScheduleUtils.swift; sourceTree = "<group>"; };
649282E92AD55323008F0F04 /* IpfConnect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IpfConnect.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1505,6 +1507,7 @@
649282EC2AD593F3008F0F04 /* OrderSourceTest.swift */,
6406F25A2AD987EB00B58C42 /* PublisherTest.swift */,
648C72462B18ABFC00E2FEF3 /* DXConnectionTest.swift */,
648C72482B19CA5A00E2FEF3 /* DXExceptionTest.swift */,
);
path = DXFeedFrameworkTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -2365,6 +2368,7 @@
6426C8912A531AAE00236784 /* EndpointTest.swift in Sources */,
6401A5162A582141009BA686 /* SystemPropertyTest.swift in Sources */,
64D0DBE82A29FF4B00710605 /* EventsTest.swift in Sources */,
648C72492B19CA5A00E2FEF3 /* DXExceptionTest.swift in Sources */,
649813C42ADD5CB2003CE3B3 /* TestEndpoointStateListener.swift in Sources */,
64ACBCEC2A29FE2300032C53 /* XCTestCase+Utils.swift in Sources */,
64ECD67F2A9CF4CB00B36935 /* IPFTests.swift in Sources */,
Expand Down
5 changes: 5 additions & 0 deletions DXFeedFramework/Native/Graal/Isolate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,9 @@ class Isolate {
let thread = currentThread()
_ = try? ErrorCheck.nativeCall(thread, dxfg_gc(thread))
}

func throwException() throws {
let thread = currentThread()
_ = try ErrorCheck.nativeCall(thread, dxfg_throw_exception(thread))
}
}
31 changes: 31 additions & 0 deletions DXFeedFrameworkTests/DXExceptionTest.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// DXExceptionTest.swift
// DXFeedFrameworkTests
//
// Created by Aleksey Kosylo on 01.12.23.
//

import XCTest
@testable import DXFeedFramework

final class DXExceptionTest: XCTestCase {

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testException() {
var failed = false
do {
try Isolate.shared.throwException()
} catch {
failed = true
}
XCTAssert(failed)
}

}

0 comments on commit 39db17c

Please sign in to comment.