<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          SwiftestSwift 的 BDD 測試框架

          聯(lián)合創(chuàng)作 · 2023-10-01 15:16

          Swiftest 是 Swift 編程語言一個 BDD 風格的規(guī)范框架。

          示例代碼:

          import Swiftest
          
          // create a class that inherits from SwiftestSuite (it's just NSObject)
          // and define the 'spec' member property of that class using `describe`
          // be sure to use `let` and not `var` here!
          
          class SampleSpec : SwiftestSuite {
            let spec = describe("Swiftest") {
              it("adds 1 + 1!") {
                expect(1 + 1).toEqual(2)
              }
          
              it("knows true from false!") {
                expect(true).toBeTrue()
                expect(true).not().toBeFalse()
              }
          
              example("comparing letters of the alphabet!") {
                expect("abc").toEqual("abc")
              }
          
              it("knows what stuff is NOT other stuff!") {
                expect(2 + 2).not().toEqual(5)
              }
          
              describe("arrays!") {
                example("special assertions for array types!") {
                  expect([1, 2, 3]).toEqual([1, 2, 3])
          
                  expect([1, 2, 3]).toContain(1)
                  expect([1, 2, 3]).toContain(1, 3)
                }
              }
          
              it("does nifty stuff with closures") {
                var a = 0
          
                expect({ a += 1 }).toChange({ a }).to(1)
                expect({ a += 1 }).toChange({ a }).from(1).to(2)
                expect({ a += 2 }).toChange({ a }).by(2)
              }
          
              example("dictionaries have special assertions too!") {
                expect([ "key" : "val" ]).toEqual([ "key" : "val"])
                expect([ "key" : "val" ]).toHaveKey("key")
                expect([ "key" : "val" ]).toHaveValue("val")
              }
          
              example("your own classes!") {
                // Person is a class that implements Comparable
                let person1 = Person(name: "Bob")
                let person2 = Person(name: "Alice")
          
                expect(person1).not().toEqual(person2)
              }
            }
          }
          瀏覽 10
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  无码免费视频观看 | 少妇后入网址 | 91精选欧美成人AAA片 | 干少妇电影无码 | 狂插猛操 |