Skip to content

Instantly share code, notes, and snippets.

@BellAppLab
BellAppLab / dLog.swift
Last active August 27, 2019 10:09
A dLog implementation in Swift.
/*
Copyright (c) 2018 Bell App Lab <apps@bellapplab.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@BellAppLab
BellAppLab / UndoManager.swift
Created February 26, 2018 20:31
Testing Apple's Undo Manager
//LE TEST
func testUndoManager() {
XCTAssertFalse(calculation.undoManager.canUndo, "A new calculation shouldn't be able to undo")
calculation.add(number: [.one])
XCTAssertTrue(calculation.undoManager.canUndo, "The calculation should be able to undo")
XCTAssertEqual(calculation.undoManager.undoMenuItemTitle, "Undo Insert 1", "Undo message is wrong")
calculation.undoManager.undo()