Skip to content

Commit

Permalink
Arquivos testes
Browse files Browse the repository at this point in the history
  • Loading branch information
brodao2 committed Dec 7, 2023
1 parent 7d849f5 commit 7d18a75
Show file tree
Hide file tree
Showing 15 changed files with 231 additions and 11 deletions.
12 changes: 1 addition & 11 deletions test/resources/projects/advpl/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"totvsLanguageServer.welcomePage": false,
"totvsLanguageServer.editor.linter.includes": "W:\\ws_tds_vscode\\tds-vscode\\test\\resources\\projects\\includes;W:\\ws_tds_vscode\\tds-vscode\\test\\resources\\projects\\includes_tlpp",
"totvsLanguageServer.editor.linter.includes": "M:\\protheus\\includes;M:\\protheus\\includes_tlpp",
"totvsLanguageServer.editor.show.notification": "all",
"totvsLanguageServer.trace.debug": "messages",
"totvsLanguageServer.trace.server": "messages",
Expand All @@ -23,16 +23,6 @@
}
}
},
"xeditor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "keyword.control",
"settings": {
"foreground": "#FF0000"
}
}
],
},
"totvsLanguageServer.compilation.generatePpoFile": false,
"totvsLanguageServer.workspaceServerConfig": true
}
13 changes: 13 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/css.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
background-color: lightblue;
}

h1 {
color: white;
text-align: center;
}

p {
font-family: verdana;
font-size: 20px;
}
25 changes: 25 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/css.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "Protheus.ch"
//#include "tds-vscode.ch"

user Function css()
local myVar := "Variavel preenchida manualmente via ADVPL"
local cCode

BeginContent var cCode as CSS
body {
background-color: lightblue;
}

h1 {
color: white;
text-align: center;
background-color: %Exp:myVar%;
}

p {
font-family: verdana;
font-size: 20px;
}
endContent

return myVar
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<HTML>

<body>
<button>%Exp:myVar%</button>
</body>

</HTML>
16 changes: 16 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/html.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "Protheus.ch"
//#include "tds-vscode.ch"

user Function html()
local myVar := "Variavel preenchida manualmente via ADVPL"
local cCode

BeginContent var cCode as HTML
<HTML>
<body>
<button>%Exp:myVar%</button>
</body>
</HTML>
endContent

return myVar
11 changes: 11 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
with (document) {
var data = {
'From_Expression: ': '%Exp:myVar%',
'name': getElementById('ID_NAME').value,
'email': getElementById('ID_EMAIL').value,
'date': getElementById('ID_DATE').value,
}
}
var text = "form:SaveData('" + JSON.stringify(data) + "')";
twebchannel.jsToAdvpl('receive_data', text, 'dummy');

25 changes: 25 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/js.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "Protheus.ch"
//#include "tds-vscode.ch"

user Function js()
local myVar := ;
"Variavel preenchida manualmente via ADVPL"
local cCode


beginContent var cCode as JS
function sendData(){
with(document){
var data = {
'From_Expression: ': %Exp:myVar%,
'name':getElementById('ID_NAME').value,
'email':getElementById('ID_EMAIL').value,
'date':getElementById('ID_DATE').value,
}
}
var text = "form:SaveData('" + JSON.stringify(data) + "')";
twebchannel.jsToAdvpl('receive_data', text, 'dummy');
}
endContent

return myVar
10 changes: 10 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/json.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"titulo": "JSON x XML",
"resumo": "o duelo de dois modelos de representação de informações",
"ano": 2012,
"genero": [
"aventura",
"ação",
"ficção"
]
}
22 changes: 22 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/json.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "Protheus.ch"
//#include "tds-vscode.ch"

user Function json()
local myVar := "Variavel preenchida manualmente via ADVPL"
local cCode

BeginContent var cCode as JSON
{
"titulo": "JSON x XML",
"resumo": "o duelo de dois modelos de representação de informações",
"ano": 2012,
"genero": [
"aventura",
"ação",
"ficção"
],
"myVar": %Exp:myVar%
}
endContent

return myVar
34 changes: 34 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/sql.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include "Protheus.ch"

user Function sql()
Local aArea := GetArea()
Local cWhere := "%B1_TIPO = 'PI' AND B1_LOCPAD = '01'%"
Local nRegs := 0

//Construindo a consulta
BeginSql Alias "SQL_SB1"
//COLUMN CAMPO AS DATE //Deve se usar isso para transformar o campo em data
SELECT
B1_COD,
B1_DESC
FROM
%table:SB1% SB1
WHERE
B1_FILIAL = %xFilial:SB1%
AND B1_MSBLQL != '1'
AND %Exp:cWhere%
AND SB1.%notDel%
EndSql

//Enquanto houver registros
While ! SQL_SB1->(EoF())
nRegs++

SQL_SB1->(DbSkip())
EndDo
SQL_SB1->(DbCloseArea())

MsgInfo("Foram processados "+cValToChar(nRegs)+" produtos.", "Atenção")

RestArea(aArea)
Return
10 changes: 10 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/sql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT
B1_COD,
B1_DESC
FROM
%table:SB1% SB1
WHERE
B1_FILIAL = %xFilial:SB1%
AND B1_MSBLQL != '1'
AND %Exp:cWhere%
AND SB1.%notDel%
23 changes: 23 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/ts.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "Protheus.ch"
//#include "tds-vscode.ch"

user Function ts()
local myVar := ;
"Variavel preenchida manualmente via ADVPL"
local cCode


beginContent var cCode as TS
import {
DocumentFormattingEditProvider,
TextDocument,
FormattingOptions,
CancellationToken,
ProviderResult,
TextEdit,
} from "vscode";

const myVar: string = %Exp:myVar%
endContent

return myVar
10 changes: 10 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/ts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {
DocumentFormattingEditProvider,
TextDocument,
FormattingOptions,
CancellationToken,
ProviderResult,
TextEdit,
} from "vscode";

const myVar: string = "%Exp:myVar%"
18 changes: 18 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/xml.prw
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "Protheus.ch"
//#include "tds-vscode.ch"

user Function xml()
local myVar := "Variavel preenchida manualmente via ADVPL"
local cCode

BeginContent var cCode as XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
<myVar>%Exp:myVar%</myVar>
</note>
endContent
return myVar
6 changes: 6 additions & 0 deletions test/resources/projects/advpl/files/embeddedLanguages/xml.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

0 comments on commit 7d18a75

Please sign in to comment.