Skip to content

document the public name and size fields in the class-fields task - #354

Merged
fey merged 1 commit into
mainfrom
fix/345-class-fields-public-props
Aug 5, 2026
Merged

document the public name and size fields in the class-fields task#354
fey merged 1 commit into
mainfrom
fix/345-class-fields-public-props

Conversation

@fey

@fey fey commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Closes #345

В задании урока «Поля класса» требовался только toString(), а тест проверяет ещё file.name и file.size. Студент, сохранивший данные в приватных полях или в одном объекте options, получал падающий тест без подсказки в условии.

Теперь условие перечисляет весь публичный контракт: name (строка) и size (число) сохраняются в публичных полях с теми же именами и доступны снаружи, плюс toString() в формате <file-name> (<size> bytes). В примере эти свойства выводятся. Тест и решение учителя не менялись, тесты зелёные.

Та же дыра была в следующем уроке 15-class-as-types — его тест тоже читает file.name/file.size, а текст об этом молчал. Там формулировка согласована с уроком 10 и дополнена тем, что признак копии остаётся приватным (соответствует private isCopy в решении учителя).

Заодно в уроке 15 поправлено описание конструктора: было «передается имя файла и размер в байтах», хотя и пример, и решение учителя принимают объект — стало «передается объект с именем файла и размером».

Отдельно, не трогал (вне скоупа issue): в примере урока 15 третий console.log печатает file2 вместо file3 — в обеих локалях.

🤖 Generated with Claude Code

The task asked only for toString(), while the test also checks file.name
and file.size. A student who hid the data in private fields or in a single
options object got a failing test with no hint in the task text.

The condition now lists the whole public contract — name and size are
stored in public fields of the same names and are reachable from outside —
and the example prints them. The test and the teacher's solution are
unchanged.

The same gap was in the next lesson, 15-class-as-types, whose test also
reads file.name/file.size: its text now states the same contract and adds
that the copy flag stays private, matching `private isCopy` in the
teacher's solution.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@fey
fey merged commit f7c5428 into main Aug 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Поля класса: задание не упоминает публичные свойства name и size, а тест их проверяет

1 participant