document the public name and size fields in the class-fields task - #354
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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