string: update the test

pull/8269/head
Alexander Medvednikov 2021-01-22 10:33:06 +01:00
parent 216fea1eb3
commit 43d56cb883
2 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,8 @@
## V 0.2.2 ## V 0.2.3
*Not yet released* *Not yet released*
## V 0.2.2
*22 Jan 2021*
- `vweb` now uses struct embedding: `app.vweb.text('hello') => app.text('hello')`. - `vweb` now uses struct embedding: `app.vweb.text('hello') => app.text('hello')`.
- Consts can now be declared outside of `const()` blocks: `const x = 0`. - Consts can now be declared outside of `const()` blocks: `const x = 0`.
- Overloading of `>`, `<`, `!=`, `==`, `<=` and `>=` operators. - Overloading of `>`, `<`, `!=`, `==`, `<=` and `>=` operators.
@ -16,6 +19,8 @@
- Fix `go` with a generic function: `go test<string>(c, 'abcd')`. - Fix `go` with a generic function: `go test<string>(c, 'abcd')`.
- Add comptime `x := $embed_file('v.png') println(x.len) println(ptr_str(x.data()))`, for embedding files into binaries. - 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. - 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 ## V 0.2.1
*30 Dec 2020* *30 Dec 2020*

View File

@ -365,16 +365,14 @@ fn test_runes() {
fn test_left_right() { fn test_left_right() {
s := 'ALOHA' s := 'ALOHA'
assert s.left(3) == 'ALO' assert s[..3] == 'ALO'
assert s.left(0) == '' assert s[..0] == ''
assert s.left(8) == s assert s[..5] == s
assert s.right(3) == 'HA'
assert s.right(6) == ''
assert s[3..] == 'HA' assert s[3..] == 'HA'
//assert s.right(6) == ''
u := s.ustring() u := s.ustring()
assert u.left(3) == 'ALO' assert u.left(3) == 'ALO'
assert u.left(0) == '' assert u.left(0) == ''
assert s.left(8) == s
assert u.right(3) == 'HA' assert u.right(3) == 'HA'
assert u.right(6) == '' assert u.right(6) == ''
} }