Skip to content

Releases: 0xOpenBytes/t

1.0.4

02 Mar 01:09
c111675
Compare
Choose a tag to compare

What's Changed

  • Correctly pass error to suite and expect by @0xLeif in #4

Full Changelog: 1.0.3...1.0.4

1.0.3

17 Feb 01:18
Compare
Choose a tag to compare

Full Changelog: 1.0.2...1.0.3

1.0.2

31 Jan 04:07
1336673
Compare
Choose a tag to compare

Full Changelog: 1.0.1...1.0.2

1.0.1

18 Jan 02:47
f4b8f43
Compare
Choose a tag to compare

What's Changed

  • Update supported platforms by @0xLeif in #3

Full Changelog: 1.0.0...1.0.1

1.0.0

03 Nov 00:44
2c35b85
Compare
Choose a tag to compare

t

Quickly test expectations

What is t?

t is a simple testing framework using closures and errors. You have the ability to create a suite that has multiple steps, expectations, and asserts. Expectations can be used to expect one or multiple assertions.

Where can t be used?

t can be used to test quickly inside a function to make sure something is working as expected. t can also be used in unit tests if wanted.

Examples

t.suite

t.suite {
    // Add an expectation that asserting true is true and that 2 is equal to 2
    try t.expect {
        try t.assert(true)
        try t.assert(2, isEqualTo: 2)
    }
    
    // Add an assertion that asserting false is not true
    try t.assert(notTrue: false)
    
    // Add an assertion that "Hello" is not equal to "World"
    try t.assert("Hello", isNotEqualTo: "World")
    
    // Log a message
    t.log("📣 Test Log Message")
    
    // Log a t.error
    t.log(error: t.error(description: "Mock Error"))
    
    // Log any error
    struct SomeError: Error { }
    t.log(error: SomeError())
    
    // Add an assertion to check if a value is nil
    let someValue: String? = nil
    try t.assert(isNil: someValue)
    
    // Add an assertion to check if a value is not nil
    let someOtherValue: String? = "💠"
    try t.assert(isNotNil: someOtherValue)
}

t.expect

try t.expect {
    let someValue: String? = "Hello"
    try t.assert(isNil: someValue)
}

t.assert

try t.assert("Hello", isEqualTo: "World")

t.log

t.log("📣 Test Log Message")

XCTest

Assert suite is true

XCTAssert(
    t.suite {
        try t.assert(true)
    }
)

Assert expectation is true

XCTAssertNoThrow(
    try t.expect("true is true and that 2 is equal to 2") {
        try t.assert(true)
        try t.assert(2, isEqualTo: 2)
    }
)

Assert is false

XCTAssertThrowsError(
    try t.assert(false)
)

What's Changed

  • Add Swift async support and unwrap and throwing functions by @0xLeif in #2

Full Changelog: 0.2.0...1.0.0

0.2.0

24 Feb 00:36
78294df
Compare
Choose a tag to compare

What's Changed

Updated

  • tError renamed TestError
  • TestError is now public
  • Regenerated Documentation

Added

  • Overridable Emojis to be used when logging
  • tested
  • async

Full Changelog: 0.1.0...0.2.0

0.1.0

03 Feb 01:21
Compare
Choose a tag to compare

t

Quickly test expectations

What is t?

t is a simple testing framework using closures and errors. You have the ability to create a suite that has multiple steps, expectations, and asserts. Expectations can be used to expect one or multiple assertions.

Where can t be used?

t can be used to test quickly inside a function to make sure something is working as expected. t can also be used in unit test if wanted.

Examples

t.suite

t.suite {
    // Add an expectation that asserting true is true and that 2 is equal to 2
    try t.expect {
        try t.assert(true)
        try t.assert(2, isEqualTo: 2)
    }
    
    // Add an assertion that asserting false is not true
    try t.assert(notTrue: false)
    
    // Add an assertion that "Hello" is not equal to "World"
    try t.assert("Hello", isNotEqualTo: "World")
    
    // Log a message
    t.log("📣 Test Log Message")
    
    // Log a t.error
    t.log(error: t.error(description: "Mock Error"))
    
    // Log any error
    struct SomeError: Error { }
    t.log(error: SomeError())
    
    // Add an assertion to check if a value is nil
    let someValue: String? = nil
    try t.assert(isNil: someValue)
    
    // Add an assertion to check if a value is not nil
    let someOtherValue: String? = "💠"
    try t.assert(isNotNil: someOtherValue)
}

t.expect

try t.expect {
    let someValue: String? = "Hello"
    try t.assert(isNil: someValue)
}

t.assert

try t.assert("Hello", isEqualTo: "World")

t.log

t.log("📣 Test Log Message")

XCTest

Assert suite is true

XCTAssert(
    t.suite {
        try t.assert(true)
    }
)

Assert expectation is true

XCTAssertNoThrow(
    try t.expect("true is true and that 2 is equal to 2") {
        try t.assert(true)
        try t.assert(2, isEqualTo: 2)
    }
)

Assert is false

XCTAssertThrowsError(
    try t.assert(false)
)