<commit_before>module Test.Spec.AssertionSpec where

import Prelude
import Control.Monad.Eff.Exception (error)
import Control.Monad.Error.Class (throwError)
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions.Aff (expectError)
import Test.Spec.Assertions.String (shouldContain, shouldNotContain)
import Test.Spec.Runner (RunnerEffects)

assertionSpec :: ∀ e. Spec (RunnerEffects e) Unit
assertionSpec =
  describe "Test" $
    describe "Spec" $
      describe "Assertions" do

        describe "String" do
          describe "shouldContain" do
            it "accepts strings that contains substrings" $
              "foobar" `shouldContain` "foo"
            it "rejects strings that does not contain substrings" $
              expectError $ "baz" `shouldContain` "foo"

          describe "shouldNotContain" do
            it "accepts strings that does not contain substrings" $
              "foobar" `shouldNotContain` "baz"
            it "rejects strings that contains substrings" $
              expectError $ "bazbar" `shouldNotContain` "baz"

        describe "Aff" $
          describe "expectError" do
            it "returns unit when given an error" $
              expectError $ throwError $ error "omg"
            it "returns an error when given a non-error" $
              expectError $ expectError $ pure "ok"
<commit_msg>Added qualified imports to distinguish string assertions from upcoming Foldable ones.<commit_after>module Test.Spec.AssertionSpec where

import Prelude
import Control.Monad.Eff.Exception (error)
import Control.Monad.Error.Class (throwError)
import Test.Spec (Spec, describe, it)
import Test.Spec.Assertions.Aff (expectError) as AF
import Test.Spec.Assertions.String (shouldContain, shouldNotContain) as AS
import Test.Spec.Runner (RunnerEffects)

assertionSpec :: ∀ e. Spec (RunnerEffects e) Unit
assertionSpec =
  describe "Test" $
    describe "Spec" $
      describe "Assertions" do

        describe "String" do
          describe "shouldContain" do
            it "accepts strings that contains substrings" $
              "foobar" `AS.shouldContain` "foo"
            it "rejects strings that does not contain substrings" $
              AF.expectError $ "baz" `AS.shouldContain` "foo"

          describe "shouldNotContain" do
            it "accepts strings that does not contain substrings" $
              "foobar" `AS.shouldNotContain` "baz"
            it "rejects strings that contains substrings" $
              AF.expectError $ "bazbar" `AS.shouldNotContain` "baz"

        describe "Aff" $
          describe "expectError" do
            it "returns unit when given an error" $
              AF.expectError $ throwError $ error "omg"
            it "returns an error when given a non-error" $
              AF.expectError $ AF.expectError $ pure "ok"

{'fraction_non_alphanumeric': 0.08424778761061946, 'fraction_numerical': 0.0, 'mean_word_length': 2.646451612903226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5880003', 'n_tokens_mistral': 788, 'n_tokens_neox': 763, 'n_words': 254}