중위 호출 연쇄: 테스트 프레임워크의 should 코틀린 테스트 DSL에서 중위 호출을 어떻게 활용하는지 살펴보자 s should startwith("kot") //DSL 단언문 표현 infix fun T.should(matcher: Matcher) = matcher.test(this) //should 함수 구현 s에 들어있는 값이"kot"로 시작하지 않으면 단언문 실패 should 함수 앞에 infix 변경자를 붙여 중위 호출 함수를 정의한다. should 함수는 Matcher 인스턴스를 요구하며, Matcher는 값에 대한 단언문을 표현하는 제네릭 인터페이스다. startwith는 Matcher를 구현하며, 문자열 시작을 검사한다. interface Matcher{ fun test(value:T) }..