<commit_before>USING: accessors continuations io.sockets io.sockets.windows kernel sequences tools.test
urls windows.winsock ;
IN: io.sockets.windows.tests

: google-socket ( -- socket )
    URL" http://www.google.com" url-addr resolve-host first
    SOCK_STREAM open-socket ;

{ } [
    google-socket
    { FIONBIO FIONREAD } [
        google-socket swap execute( -- x )
        [ 1 set-ioctl-socket ] [ 0 set-ioctl-socket ] 2bi
    ] each drop
] unit-test

{ t } [
    [ google-socket 1337 -8 set-ioctl-socket ]
    [ [ winsock-exception? ] [ n>> 10045 = ] bi and ] recover
] unit-test
<commit_msg>io.sockets.windows.tests: plugs the socket leaks (#1104)<commit_after>USING: accessors continuations destructors io.sockets io.sockets.windows
kernel sequences tools.test urls windows.winsock ;
IN: io.sockets.windows.tests

: google-socket ( -- socket )
    URL" http://www.google.com" url-addr resolve-host first
    SOCK_STREAM open-socket ;

{ } [
    { FIONBIO FIONREAD } [
        google-socket [
            swap execute( -- x )
            [ 1 set-ioctl-socket ] [ 0 set-ioctl-socket ] 2bi
        ] with-disposal
    ] each
] unit-test

{ t } [
    google-socket [
        [  1337 -8 set-ioctl-socket ]
        [ [ winsock-exception? ] [ n>> 10045 = ] bi and ] recover
    ] with-disposal
] unit-test

{'fraction_non_alphanumeric': 0.1252864782276547, 'fraction_numerical': 0.02291825821237586, 'mean_word_length': 2.5026737967914436, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1878162', 'n_tokens_mistral': 459, 'n_tokens_neox': 436, 'n_words': 102}