fntest_add() {mut a :='a' a +='b'assert a==('ab') a ='a'for i :=1; i <1000; i++ { a +='b' }assert a.len ==1000assert a.ends_with('bbbbb') a +='123'assert a.ends_with('3')}fntest_ends_with() { a :='browser.v'assert a.ends_with('.v')}fntest_between() { s :='hello [man] how you doing'assert s.find_between('[',']') =='man'}
[if macos] //只有macos系统中才执行测试pub fntest_in_macos() {println("test in macos")asserttrue}[if!macos] //只有非macos系统才执行测试pub fntest_not_in_macos() {$if!macos {println("test not in macos") }$if macos {println("test in macos") }println("test only not in macos")assertfalse}[if linux] pub fntest_only_in_linux() {println("test only in linux")assertfalse}[if linux || windows] //在linux或windows系统中才执行测试pub fntest_in_linux_or_macos() {println("test in linux or macos")assertfalse}