@@ -276,6 +276,69 @@ test "e_low_level_lambda - Str.concat with longer strings" {
276276 try testing .expectEqualStrings ("\" This is a longer string that contains about one hundred characters for testing concatenation. This is the second string that also has many characters in it for testing longer string operations.\" " , value );
277277}
278278
279+ test "e_low_level_lambda - Str.contains with substring in middle" {
280+ const src =
281+ \\x = Str.contains("foobarbaz", "bar")
282+ ;
283+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
284+ defer test_allocator .free (value );
285+ try testing .expectEqualStrings ("True" , value );
286+ }
287+
288+ test "e_low_level_lambda - Str.contains with non-matching strings" {
289+ const src =
290+ \\x = Str.contains("apple", "orange")
291+ ;
292+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
293+ defer test_allocator .free (value );
294+ try testing .expectEqualStrings ("False" , value );
295+ }
296+
297+ test "e_low_level_lambda - Str.contains with empty needle" {
298+ const src =
299+ \\x = Str.contains("anything", "")
300+ ;
301+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
302+ defer test_allocator .free (value );
303+ try testing .expectEqualStrings ("True" , value );
304+ }
305+
306+ test "e_low_level_lambda - Str.contains with substring at start" {
307+ const src =
308+ \\x = Str.contains("hello world", "hello")
309+ ;
310+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
311+ defer test_allocator .free (value );
312+ try testing .expectEqualStrings ("True" , value );
313+ }
314+
315+ test "e_low_level_lambda - Str.contains with substring at end" {
316+ const src =
317+ \\x = Str.contains("hello world", "world")
318+ ;
319+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
320+ defer test_allocator .free (value );
321+ try testing .expectEqualStrings ("True" , value );
322+ }
323+
324+ test "e_low_level_lambda - Str.contains with empty haystack" {
325+ const src =
326+ \\x = Str.contains("", "hello")
327+ ;
328+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
329+ defer test_allocator .free (value );
330+ try testing .expectEqualStrings ("False" , value );
331+ }
332+
333+ test "e_low_level_lambda - Str.contains with identical strings" {
334+ const src =
335+ \\x = Str.contains("test", "test")
336+ ;
337+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
338+ defer test_allocator .free (value );
339+ try testing .expectEqualStrings ("True" , value );
340+ }
341+
279342test "e_low_level_lambda - Str.caseless_ascii_equals with equal strings" {
280343 const src =
281344 \\x = Str.caseless_ascii_equals("hello", "hello")
@@ -474,6 +537,60 @@ test "e_low_level_lambda - Str.trim with a non-whitespace string" {
474537 try testing .expectEqualStrings ("\" hello\" " , value );
475538}
476539
540+ test "e_low_level_lambda - Str.trim_start with an empty string" {
541+ const src =
542+ \\x = Str.trim_start("")
543+ ;
544+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
545+ defer test_allocator .free (value );
546+ try testing .expectEqualStrings ("\"\" " , value );
547+ }
548+
549+ test "e_low_level_lambda - Str.trim_start with a whitespace string" {
550+ const src =
551+ \\x = Str.trim_start(" ")
552+ ;
553+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
554+ defer test_allocator .free (value );
555+ try testing .expectEqualStrings ("\"\" " , value );
556+ }
557+
558+ test "e_low_level_lambda - Str.trim_start with a non-whitespace string" {
559+ const src =
560+ \\x = Str.trim_start(" hello ")
561+ ;
562+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
563+ defer test_allocator .free (value );
564+ try testing .expectEqualStrings ("\" hello \" " , value );
565+ }
566+
567+ test "e_low_level_lambda - Str.trim_end with an empty string" {
568+ const src =
569+ \\x = Str.trim_end("")
570+ ;
571+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
572+ defer test_allocator .free (value );
573+ try testing .expectEqualStrings ("\"\" " , value );
574+ }
575+
576+ test "e_low_level_lambda - Str.trim_end with a whitespace string" {
577+ const src =
578+ \\x = Str.trim_end(" ")
579+ ;
580+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
581+ defer test_allocator .free (value );
582+ try testing .expectEqualStrings ("\"\" " , value );
583+ }
584+
585+ test "e_low_level_lambda - Str.trim_end with a non-whitespace string" {
586+ const src =
587+ \\x = Str.trim_end(" hello ")
588+ ;
589+ const value = try evalModuleAndGetString (src , 0 , test_allocator );
590+ defer test_allocator .free (value );
591+ try testing .expectEqualStrings ("\" hello\" " , value );
592+ }
593+
477594test "e_low_level_lambda - List.concat with two non-empty lists" {
478595 const src =
479596 \\x = List.concat([1, 2], [3, 4])
0 commit comments