Skip to content

Commit

Permalink
Disable gravity tests for HTML5
Browse files Browse the repository at this point in the history
Will solve this at a later time.
Issue: #36
  • Loading branch information
STREGA committed Jul 30, 2023
1 parent 971b5df commit 7e92c61
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 9 deletions.
30 changes: 21 additions & 9 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ let package = Package(
// SwiftWASM
#if os(macOS) || os(Linux)
packageDependencies.append(contentsOf: [
.package(path: "~/Documents/GitHub/JavaScriptKit"),
.package(url: "https://github.com/swiftwasm/WebAPIKit.git", branch: "main"),
.package(url: "https://github.com/swiftwasm/JavaScriptKit.git", .upToNextMajor(from: "0.16.0")),
// .package(url: "https://github.com/swiftwasm/JavaScriptKit.git", .upToNextMajor(from: "0.16.0")),
])
#endif

Expand Down Expand Up @@ -300,14 +301,25 @@ let package = Package(
// MARK: - Tests

targets.append(contentsOf: [
.testTarget(name: "GateEngineTests", dependencies: ["GateEngine"], resources: [.copy("Resources")]),
.testTarget(name: "GameMathTests", dependencies: ["GameMath"]),
.testTarget(name: "GravityTests", dependencies: ["Gravity", "GateEngine"], resources: [
.copy("Resources/disabled"),
.copy("Resources/fuzzy"),
.copy("Resources/infiniteloop"),
.copy("Resources/unittest"),
]),
.testTarget(name: "GateEngineTests",
dependencies: ["GateEngine"],
resources: [.copy("Resources")],
swiftSettings: [
.define("DISABLE_GRAVITY_TESTS", .when(platforms: [.wasi])),
]),
.testTarget(name: "GameMathTests",
dependencies: ["GameMath"]),
.testTarget(name: "GravityTests",
dependencies: ["Gravity", "GateEngine"],
resources: [
.copy("Resources/disabled"),
.copy("Resources/fuzzy"),
.copy("Resources/infiniteloop"),
.copy("Resources/unittest"),
],
swiftSettings: [
.define("DISABLE_GRAVITY_TESTS", .when(platforms: [.wasi])),
]),
])
#if !os(Windows)
targets.append(contentsOf: [
Expand Down
7 changes: 7 additions & 0 deletions Tests/GateEngineTests/FileSystemTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
/*
* Copyright © 2023 Dustin Collins (Strega's Gate)
* All Rights Reserved.
*
* http://stregasgate.com
*/

import XCTest
@testable import GateEngine

Expand Down
10 changes: 10 additions & 0 deletions Tests/GateEngineTests/Gravity/GravityCreateValueTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright © 2023 Dustin Collins (Strega's Gate)
* All Rights Reserved.
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

import XCTest
@testable import GateEngine

Expand Down Expand Up @@ -49,3 +57,5 @@ final class GravityCreateValueTests: GateEngineXCTestCase {
XCTAssertNotEqual(GravityValue([1: true]), [1.0: 1]) // Casting should not work
}
}

#endif
10 changes: 10 additions & 0 deletions Tests/GateEngineTests/Gravity/GravityErrorTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright © 2023 Dustin Collins (Strega's Gate)
* All Rights Reserved.
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

import XCTest
@testable import GateEngine

Expand Down Expand Up @@ -35,3 +43,5 @@ final class GravityErrorTests: GateEngineXCTestCase {
XCTAssertEqual(gravity.getVar("myVar"), 10)
}
}

#endif
10 changes: 10 additions & 0 deletions Tests/GateEngineTests/Gravity/GravityExtendingTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright © 2023 Dustin Collins (Strega's Gate)
* All Rights Reserved.
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

import XCTest
@testable import GateEngine

Expand Down Expand Up @@ -82,3 +90,5 @@ final class GravityExtendingTests: GateEngineXCTestCase {
XCTAssertEqual(try instance.runFunc("myFunc"), "success!")
}
}

#endif
10 changes: 10 additions & 0 deletions Tests/GateEngineTests/Gravity/GravityIncludesTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright © 2023 Dustin Collins (Strega's Gate)
* All Rights Reserved.
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

import XCTest
@testable import GateEngine

Expand All @@ -10,3 +18,5 @@ final class GravityIncludesTests: GateEngineXCTestCase {
XCTAssertEqual(try gravity.runMain(), 123456789)
}
}

#endif
10 changes: 10 additions & 0 deletions Tests/GateEngineTests/Gravity/GravityMultipleInstanceTests.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* Copyright © 2023 Dustin Collins (Strega's Gate)
* All Rights Reserved.
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

import XCTest
@testable import GateEngine

Expand All @@ -21,3 +29,5 @@ final class GravityMultipleInstanceTests: GateEngineXCTestCase {
XCTAssertEqual(try gravity1.runMain(), 11)
}
}

#endif
2 changes: 2 additions & 0 deletions Tests/GravityTests/Unittest/Unittest01SyntaxTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

final class Unittest01SyntaxTests: GravityXCTestCase {
func testSyntaxClassDeclaration() async {
Expand Down Expand Up @@ -45,3 +46,4 @@ final class Unittest01SyntaxTests: GravityXCTestCase {
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

final class Unittest02SemanticStep1Tests: GravityXCTestCase {
func testClass1Redeclared() async {
Expand Down Expand Up @@ -35,3 +36,4 @@ final class Unittest02SemanticStep1Tests: GravityXCTestCase {
}
}

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

final class Unittest03SemanticStep2Tests: GravityXCTestCase {
func testClass1AccessSpecifier() async {
Expand Down Expand Up @@ -67,3 +68,4 @@ final class Unittest03SemanticStep2Tests: GravityXCTestCase {
}
}

#endif
2 changes: 2 additions & 0 deletions Tests/GravityTests/Unittest/Unittest04CodegenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

final class Unittest04CodegenTests: GravityXCTestCase {
func testAssignment1() async {
Expand Down Expand Up @@ -71,3 +72,4 @@ final class Unittest04CodegenTests: GravityXCTestCase {
}
}

#endif
3 changes: 3 additions & 0 deletions Tests/GravityTests/_GravityXCTestCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*
* http://stregasgate.com
*/
#if !DISABLE_GRAVITY_TESTS

import XCTest
@testable import GateEngine
Expand Down Expand Up @@ -81,3 +82,5 @@ open class GravityXCTestCase: XCTestCase {
#endif
}
}

#endif

0 comments on commit 7e92c61

Please sign in to comment.