<commit_before># vim:set ft= ts=4 sw=4 et fdm=marker:

use lib 'lib';
use Test::Nginx::Socket;

repeat_each(2);

plan tests => repeat_each() * (blocks() * 3);

our $HtmlDir = html_dir;

$ENV{TEST_NGINX_CLIENT_PORT} ||= server_port();
#$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;

no_long_string();
#no_diff();
#log_level 'warn';

run_tests();

__DATA__

=== TEST 1: receive
--- config
    location /t {
        content_by_lua '
            local sock, err = ngx.req.socket()
            sock.receive("l")
        ';
    }
--- request
    GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
bad argument #1 to 'receive' (table expected, got string)



=== TEST 2: receiveuntil
--- config
    location /t {
        content_by_lua '
            local sock, err = ngx.req.socket()
            sock.receiveuntil(32, "ab")
        ';
    }
--- request
    GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
bad argument #1 to 'receiveuntil' (table expected, got number)



=== TEST 3: send (bad arg number)
--- config
    location /t {
        content_by_lua '
            local sock, err = ngx.socket.tcp()
            sock.send("hello")
        ';
    }
--- request
    GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
expecting two arguments (including the object), but got 1



=== TEST 4: send (bad self)
--- config
    location /t {<commit_msg>fixed a bad test case in 083-bad-sock-self.t.<commit_after># vim:set ft= ts=4 sw=4 et fdm=marker:

use lib 'lib';
use Test::Nginx::Socket;

repeat_each(2);

plan tests => repeat_each() * (blocks() * 3);

our $HtmlDir = html_dir;

$ENV{TEST_NGINX_CLIENT_PORT} ||= server_port();
#$ENV{TEST_NGINX_MEMCACHED_PORT} ||= 11211;

no_long_string();
#no_diff();
#log_level 'warn';

run_tests();

__DATA__

=== TEST 1: receive
--- config
    location /t {
        content_by_lua '
            local sock, err = ngx.req.socket()
            sock.receive("l")
        ';
    }
--- request
    GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
bad argument #1 to 'receive' (table expected, got string)



=== TEST 2: receiveuntil
--- config
    location /t {
        content_by_lua '
            local sock, err = ngx.req.socket()
            sock.receiveuntil(32, "ab")
        ';
    }
--- request
    GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
bad argument #1 to 'receiveuntil' (table expected, got number)



=== TEST 3: send (bad arg number)
--- config
    location /t {
        content_by_lua '
            local sock, err = ngx.socket.tcp()
            sock.send("hello")
        ';
    }
--- request
    GET /t
--- response_body_like: 500 Internal Server Error
--- error_code: 500
--- error_log
expecting 2 arguments (including the object), but got 1



=== TEST 4: send (bad self)
--- config
    location /t {
{'fraction_non_alphanumeric': 0.14503042596348883, 'fraction_numerical': 0.025693035835023664, 'mean_word_length': 2.4567757009345796, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5486021', 'n_tokens_mistral': 1071, 'n_tokens_neox': 983, 'n_words': 284}