Files
kucherenko__jscpd/fixtures/smalltalk/file1.st
apk 64e471e2b0 test: raise coverage to 96%+ on @jscpd/finder and 98%+ on apps/jscpd
Adds 92 new tests (178 → 270 total) with zero source-file modifications:

- packages/finder: 13 new test files covering all reporters, subscribers,
  validators, hooks, utils, options, cloneFound, getFilesToDetect, and
  InFilesDetector; shared buildClone() factory helper
- apps/jscpd: 3 new test files (options-unit, print, store) plus extensions
  to formats, modes, and options integration tests
- vitest.config.ts added to both packages to restrict coverage.include
  to src/** only, eliminating bin/ and prism.js noise
- Fixes 3 tokenizer bugs (trailing space in format lookup, tokenization
  edge cases) uncovered by the new format fixture suite
- Adds fixture files for 40+ language formats to support formats.test.ts
2026-05-09 15:00:38 +02:00

51 lines
1.0 KiB
Smalltalk

Object subclass: #DataProcessor
instanceVariableNames: 'items capacity maxLength'
classVariableNames: ''
poolDictionaries: ''
category: 'Example-Utils'
DataProcessor class >> new [
^super new initialize
]
DataProcessor >> initialize [
capacity := 100.
maxLength := 255.
items := OrderedCollection new.
]
DataProcessor >> validateInput: aString [
aString isEmpty ifTrue: [
Error signal: 'Input cannot be empty'
].
aString size > maxLength ifTrue: [
Error signal: 'Input exceeds maximum length'
].
^aString
]
DataProcessor >> addItem: anItem [
| validated |
validated := self validateInput: anItem.
items add: validated.
^self
]
DataProcessor >> removeItem: anItem [
items remove: anItem ifAbsent: [nil].
^self
]
DataProcessor >> count [
^items size
]
DataProcessor >> isEmpty [
^items isEmpty
]
"File-specific: sum numeric items"
DataProcessor >> sumValues [
^items inject: 0 into: [:acc :each | acc + each]
]