Skip to content

Commit

Permalink
Typo: Update ch11-01-writing-tests.md (#44)
Browse files Browse the repository at this point in the history
* Typo: Update ch11-01-writing-tests.md

'assert_ne' -> 'assert_ne!'
로 오타를 수정하였습니다!

* Typo: Update ch11-01-writing-tests.md

'트레이트가기' -> '트레이트이기'
오타 수정하였습니다!
  • Loading branch information
boulce committed Feb 29, 2024
1 parent 6fae08f commit 9f2d3d6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ch11-01-writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,15 @@ cd ../../..
입력값과 함수 출력이 동일하면 안 된다고 테스트를 작성하는 게
가장 좋을 겁니다.

내부적으로 `assert_eq!`, `assert_ne` 매크로는 각각 `==`, `!=`
내부적으로 `assert_eq!`, `assert_ne!` 매크로는 각각 `==`, `!=`
연산자를 사용합니다. 단언에 실패할 경우, 매크로는 인수를 디버그 형식으로
출력하는데, 즉 `assert_eq!`, `assert_ne` 매크로로 비교할 값은
출력하는데, 즉 `assert_eq!`, `assert_ne!` 매크로로 비교할 값은
`PartialEq`, `Debug` 트레이트를 구현해야 합니다.
모든 기본 타입 및 대부분의 표준 라이브러리 타입은 이 두 트레이트를 구현합니다.
직접 정의한 구조체나 열거형의 경우에는 `PartialEq` 트레이트를 구현하여
해당 타입의 값이 같음을 단언할 수 있도록 할 필요가 있습니다. 또한
단언 실패 시 값이 출력될 수 있도록 `Debug` 트레이트도 구현해야 합니다.
5장 예제 5-12에서 설명했듯 두 트레이트 모두 파생 가능한 트레이트가기 때문에,
5장 예제 5-12에서 설명했듯 두 트레이트 모두 파생 가능한 트레이트이기 때문에,
구조체, 열거형 정의에 `#[derive(PartialEq, Debug)]`를 어노테이션하는 것이 일반적입니다.
이에 대한 추가 내용 및 파생 가능한 나머지 트레이트는
부록 C [‘파생 가능한 트레이트’][derivable-traits]<!-- ignore -->를 참고해 주세요.
Expand Down

0 comments on commit 9f2d3d6

Please sign in to comment.