Merge pull request #6596 from brunolm/assertsharp

Add new package definition Assertsharp
This commit is contained in:
Masahiro Wakame
2015-11-05 22:12:18 +09:00
2 changed files with 37 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
/// <reference path="./assertsharp.d.ts" />
import Assert from "assertsharp";
Assert.AreEqual(0, 0, "Pass");
Assert.AreNotEqual(0, 1, "Pass");
Assert.AreNotSame(new Date(), new Date(), "Pass");
Assert.AreSequenceEqual([0], [0], (x, y) => x === y, "Pass");
Assert.Fail("Should fail");
Assert.IsFalse(false, "Pass");
Assert.IsInstanceOfType(new Date(), Date, "Pass");
Assert.IsNotInstanceOfType(true, Date, "Pass");
Assert.IsNotNull(new Date(), "Pass");
Assert.IsNull(null, "Pass");
Assert.IsTrue(true, "Pass");
Assert.Throws(() => { throw ""; }, "Pass");
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for assertsharp
// Project: https://www.npmjs.com/package/assertsharp
// Definitions by: Bruno Leonardo Michels <https://github.com/brunolm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "assertsharp" {
export default class Assert {
static AreEqual<T>(expected: T, actual: T, message?: string): void;
static AreNotEqual<T>(notExpected: T, actual: T, message?: string): void;
static AreNotSame<T>(notExpected: T, actual: T, message?: string): void;
static AreSequenceEqual<T>(expected: T[], actual: T[], equals?: (x: any, y: any) => boolean, message?: string): void;
static Fail(message?: string): void;
static IsFalse(actual: boolean, message?: string): void;
static IsInstanceOfType(actual: any, expectedType: Function, message?: string): void;
static IsNotInstanceOfType(actual: any, wrongType: Function, message?: string): void;
static IsNotNull(actual: any, message?: string): void;
static IsNull(actual: any, message?: string): void;
static IsTrue(actual: boolean, message?: string): void;
static Throws(fn: () => void, message?: string): void;
}
}