Avatar
norio_nomura 2/17/2018 4:42 AM
これのおかげで、associated valueは無視して期待するError enumが投げられるかどうかのテストを XCTAssertThrowsError(try YAMLDecoder().decode(Sample.self, from: invalidYaml)) { error in if case DecodingError.typeMismatch(_, _) = error {} else { XCTFail("unexpected error: \(error)") } } の様に記述できる。 (edited)