From 43d56cb88387353ebd99678d7ae068f2f81451d8 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 22 Jan 2021 10:33:06 +0100 Subject: [PATCH] string: update the test --- CHANGELOG.md | 7 ++++++- vlib/builtin/string_test.v | 10 ++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc0bfc6ef3..ee683020e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ -## V 0.2.2 +## V 0.2.3 *Not yet released* + +## V 0.2.2 +*22 Jan 2021* - `vweb` now uses struct embedding: `app.vweb.text('hello') => app.text('hello')`. - Consts can now be declared outside of `const()` blocks: `const x = 0`. - Overloading of `>`, `<`, `!=`, `==`, `<=` and `>=` operators. @@ -16,6 +19,8 @@ - Fix `go` with a generic function: `go test(c, 'abcd')`. - Add comptime `x := $embed_file('v.png') println(x.len) println(ptr_str(x.data()))`, for embedding files into binaries. - Advanced vdoc search on mobile layout. +- string's `left()`/`right` were removed in favor of slicing syntax: `str[..pos]`. +- gg: native graphics mode on macOS/iOS (using Cocoa Drawing API). ## V 0.2.1 *30 Dec 2020* diff --git a/vlib/builtin/string_test.v b/vlib/builtin/string_test.v index 3c8bd0e8ae..9aca92e4af 100644 --- a/vlib/builtin/string_test.v +++ b/vlib/builtin/string_test.v @@ -365,16 +365,14 @@ fn test_runes() { fn test_left_right() { s := 'ALOHA' - assert s.left(3) == 'ALO' - assert s.left(0) == '' - assert s.left(8) == s - assert s.right(3) == 'HA' - assert s.right(6) == '' + assert s[..3] == 'ALO' + assert s[..0] == '' + assert s[..5] == s assert s[3..] == 'HA' + //assert s.right(6) == '' u := s.ustring() assert u.left(3) == 'ALO' assert u.left(0) == '' - assert s.left(8) == s assert u.right(3) == 'HA' assert u.right(6) == '' }