From 7e357eea625b4f065a6f7736c269813c31b5ab58 Mon Sep 17 00:00:00 2001 From: Celestino Amoroso Date: Mon, 17 Jun 2024 09:53:21 +0200 Subject: [PATCH] changed to comply new builtin-os-file.go's function names --- t_builtin-os-file_test.go | 8 ++++---- t_expr_test.go | 2 +- t_iterator_test.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/t_builtin-os-file_test.go b/t_builtin-os-file_test.go index c86c5a1..665e7d9 100644 --- a/t_builtin-os-file_test.go +++ b/t_builtin-os-file_test.go @@ -16,10 +16,10 @@ func TestFuncOs(t *testing.T) { /* 2 */ {`builtin "os.file"; handle=fileOpen("/etc/hosts"); fileClose(handle)`, true, nil}, /* 3 */ {`builtin "os.file"; handle=fileOpen("/etc/hostsX")`, nil, errors.New(`open /etc/hostsX: no such file or directory`)}, /* 4 */ {`builtin "os.file"; handle=fileCreate("/tmp/dummy"); fileClose(handle)`, true, nil}, - /* 5 */ {`builtin "os.file"; handle=fileAppend("/tmp/dummy"); fileWrite(handle, "bye-bye"); fileClose(handle)`, true, nil}, - /* 6 */ {`builtin "os.file"; handle=fileOpen("/tmp/dummy"); word=fileRead(handle, "-"); fileClose(handle);word`, "bye", nil}, - /* 7 */ {`builtin "os.file"; word=fileRead(nil, "-")`, nil, errors.New(`readFileFunc(): invalid file handle`)}, - /* 7 */ {`builtin "os.file"; fileWrite(nil, "bye")`, nil, errors.New(`writeFileFunc(): invalid file handle`)}, + /* 5 */ {`builtin "os.file"; handle=fileAppend("/tmp/dummy"); fileWriteText(handle, "bye-bye"); fileClose(handle)`, true, nil}, + /* 6 */ {`builtin "os.file"; handle=fileOpen("/tmp/dummy"); word=fileReadText(handle, "-"); fileClose(handle);word`, "bye", nil}, + /* 7 */ {`builtin "os.file"; word=fileReadText(nil, "-")`, nil, errors.New(`fileReadText(): invalid file handle`)}, + /* 7 */ {`builtin "os.file"; fileWriteText(nil, "bye")`, nil, errors.New(`fileWriteText(): invalid file handle`)}, } // t.Setenv("EXPR_PATH", ".") diff --git a/t_expr_test.go b/t_expr_test.go index 6b3d0ac..d166fcb 100644 --- a/t_expr_test.go +++ b/t_expr_test.go @@ -14,7 +14,7 @@ func TestExpr(t *testing.T) { inputs := []inputType{ /* 1 */ {`0?{}`, nil, nil}, /* 2 */ {`fact=func(n){(n)?{1}::{n*fact(n-1)}}; fact(5)`, int64(120), nil}, - /* 3 */ {`builtin "os.file"; f=fileOpen("test-file.txt"); line=fileRead(f); fileClose(f); line`, "uno", nil}, + /* 3 */ {`builtin "os.file"; f=fileOpen("test-file.txt"); line=fileReadText(f); fileClose(f); line`, "uno", nil}, /* 4 */ {`mynot=func(v){int(v)?{true}::{false}}; mynot(0)`, true, nil}, /* 5 */ {`1 ? {1} : [1+0] {3*(1+1)}`, int64(6), nil}, /* 6 */ {` diff --git a/t_iterator_test.go b/t_iterator_test.go index d99551f..14dc67d 100644 --- a/t_iterator_test.go +++ b/t_iterator_test.go @@ -14,9 +14,9 @@ func TestIteratorParser(t *testing.T) { /* 4 */ {`include "test-resources/iterator.expr"; it=$(ds,3); it++; it++; it.reset; ()it`, int64(0), nil}, /* 5 */ {`builtin "math.arith"; include "test-resources/iterator.expr"; it=$(ds,3); add(it)`, int64(6), nil}, /* 6 */ {`builtin "math.arith"; include "test-resources/iterator.expr"; it=$(ds,3); mul(it)`, int64(0), nil}, - /* 7 */ {`builtin "math.arith"; include "test-resources/file-reader.expr"; it=$(ds,"int.list"); mul(it)`, int64(12000), nil}, - /* 8 */ {`include "test-resources/file-reader.expr"; it=$(ds,"int.list"); it++; it.index`, int64(0), nil}, - /* 10 */ {`include "test-resources/file-reader.expr"; it=$(ds,"int.list"); it.clean`, true, nil}, + /* 7 */ {`builtin "math.arith"; include "test-resources/file-reader.expr"; it=$(ds,"test-resources/int.list"); mul(it)`, int64(12000), nil}, + /* 8 */ {`include "test-resources/file-reader.expr"; it=$(ds,"test-resources/int.list"); it++; it.index`, int64(0), nil}, + /* 10 */ {`include "test-resources/file-reader.expr"; it=$(ds,"test-resources/int.list"); it.clean`, true, nil}, /* 11 */ {`it=$(1,2,3); it++`, int64(1), nil}, } // inputs1 := []inputType{