Object subclass: #AwesomeBusinessObject instanceVariableNames: 'shortText value count longText' classVariableNames: '' package: 'NeoCSVEndlessLoopTest'! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! longText: anObject longText := anObject! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! shortText ^ shortText! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! shortText: anObject shortText := anObject! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! value: anObject value := anObject! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! count: anObject count := anObject! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:05'! value ^ value! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! longText ^ longText! ! !AwesomeBusinessObject methodsFor: 'accessing' stamp: 'JoachimTuchel 1/4/2021 14:04'! count ^ count! ! TestCase subclass: #NeoCSVEndlessLoopTestCase instanceVariableNames: 'reader' classVariableNames: '' package: 'NeoCSVEndlessLoopTest'! !NeoCSVEndlessLoopTestCase methodsFor: 'running' stamp: 'JoachimTuchel 1/4/2021 14:42'! setUp super setUp. reader := NeoCSVReader new. reader separator: $;. reader recordClass: AwesomeBusinessObject . reader addField: #shortText:. " reader addField: #value: converter: [:inp| ScaledDecimal fromString: inp]. " reader addField: #count:. reader addField: #longText:. reader on: (ReadStream on: self input).! ! !NeoCSVEndlessLoopTestCase methodsFor: 'running' stamp: 'JoachimTuchel 1/4/2021 14:08'! input ^'"Line1";"15.0s2";3000;"Smalltalk is cool" "Line2";"25.3s3";1000;"JavaScript is said to be cool" "Line 3";"1.0s2";8000;"Python seems to wipe the all from the table"'! ! !NeoCSVEndlessLoopTestCase methodsFor: 'running' stamp: 'JoachimTuchel 1/4/2021 14:07'! testWrongNumberOfObjects | objects | objects := reader upToEnd. self assert: (objects size = 3). self assert: (objects allSatisfy: [:ea | ea longText isEmptyOrNil not])! !