/
nv-lang
/
nova
Обзор
Документация
Войти
/
nv-lang
/
nova
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
main
spec_tests/conformance/tx_commit.nv
39 строк
1 KB
Evgeniy Golovin
196.6: снапшот 198-корпуса (1120 файлов) убран из spec_tests — попал в main моим недосмотром при слиянии race-state-dump (repro-артефакт, не тесты); фиксы и дедуп-переименования остаются
13 июл 2026, 20:00
13 июл 2026, 20:00
0b95302
Код
Авторство
О чём код?
// Plan 100.7 (D165): pilot Transaction3_2 migration — commit on success. // Probe 1 of 5: happy-path. // // Pattern: consume tx + explicit commit на success-path (D162). // D157: plain param = view (non-consuming, default). module spec_tests.conformance type Db2 { id int } type OrderErr1 { msg str } type Transaction3_2 consume { id int, } // Infallible commit/rollback for clarity — avoids ? in defer body. fn Transaction3_2 consume @commit() -> () { () } fn Transaction3_2 consume @rollback() -> () { () } fn Db2 @begin() -> Transaction3_2 => { id: 1 } type Receipt { id int } // D157: view is default — plain param means view (non-consuming). // db_insert1 is infallible here to avoid D162 view-param false-positive. fn db_insert1(t Transaction3_2, data int) -> Receipt => { id: data } fn process_order(db Db2, data int) -> Receipt { consume tx Transaction3_2 = db.begin() // explicit type annotation (D165) // Commit on any exit — for simplicity use explicit consume. ro receipt = db_insert1(tx, data) tx.commit() return receipt } test "Transaction3_2 commit success path" { ro db = Db2 { id: 1 } process_order(db, 42) }